/**
 * 场景操作的相关方法
 */
//var baseUrl = "http://yklink.net:36002/";
var baseUrl = localStorage.getItem("baseURL");
//监控模块类型
var viewDataType = "data";
console.log(baseUrl);


//获取当前项目ID
localStorage.setItem("optionId", $_GET.selectOneWhere);

! function(win) {
	"use strict";
	var StageOperation = function() {
		this.moudleObj = {};
		this.GUIDELINE_OFFSET = 5;
		this.keyisUp = true;
	}
	StageOperation.prototype = {
		constructor: StageOperation,
		/**
		 * 初始化画布
		 */
		initStage: function(stage_id, element, stageObjJsonTemp, moduleStageStatus) {
			// 获取数据点数据 已无用
			// var hardwareData = eval("initConfig."+initjson.hardwareDataFunction+"(stage_id)");
			// win.jyzt_hardwareData = hardwareData ; //将数据点数据作为全局变量
			// console.log(win.jyzt_hardwareData);
			var stage;
			var layer;
			var layer_grid;
			var layer_three;
			if ((stage_id == "" || typeof(stage_id) == "undefined") && typeof(stageObjJsonTemp) ==
				"undefined") { //新增
				stage = new Konva.Stage({
					container: 'container',
					width: 1920,
					height: 1080,
					id: Math.uuid()
				});
				stage.attrs.type="normal";
				$("#stageSizeSelect").show();
				$("#stageSizeSet").hide();

				//stage.add({type:'normal'});
				//裁剪分辨路大小的方出来，用于遮挡参考线的边缘
				layer_grid = new Konva.Layer({
					name: "layer_grid",
					id: Math.uuid(),
					clip: {
						x: 0,
						y: 0,
						width: 1920,
						height: 1080,

					},
				});
				stage.add(layer_grid);
				var background = new Konva.Rect({
					x: 0,
					y: 0,
					stroke: '#000000', //边框颜色',
					width: stage.width(),
					height: stage.height(),
					fill: 'rgba(202, 236, 248, 1)',
					listening: false,
					strokeWidth: 0, //边框宽度
					name: 'layer_background'
				});
				layer_grid.add(background);
				layer_grid.draw();

				layer = new Konva.Layer({
					id: Math.uuid()
				});
				stage.add(layer);
				layer_three = new Konva.Layer({
					id: Math.uuid(),
					name: "layer_three"
				}); //最上面一层
				stage.add(layer_three);
				$("#container").height(1080);
				$("#container").width(1920);
			} else { // 编辑
				var stageObjJson;
				if (typeof(stageObjJsonTemp) == "undefined") {
					//获取图纸字符串
					stageObjJson = eval("initConfig." + initjson.editCallbackFunction + "(\"" + stage_id +
						"\")");
				} else {
					//获取模板
					stageObjJson = stageObjJsonTemp;
				}
				try {
					stage = Konva.Node.create(stageObjJson, 'container');
					if(!stage.attrs.type){
					    stage.attrs.type="normal";
					}else{
						console.log(stage.attrs.type);
					}
				} catch (e) {
					console.log("场景字符串异常");
					var tempStr =
						'{"attrs":{"width":1920,"height":1080,"id":"1B3A48F9507F984AE5CA6BBD98D058581C61","conditionInfo":{"conditionType":"0","conditionWhere":""}},"className":"Stage","children":[{"attrs":{"name":"layer_grid","id":"15AA817C774AE5412DFA01CE79ABDA1381DA","clipX":0,"clipY":0,"clipWidth":1920,"clipHeight":1080},"className":"Layer","children":[{"attrs":{"stroke":"#000000","width":1920,"height":1080,"fill":"#caecf8","listening":false,"strokeWidth":0,"name":"layer_background"},"className":"Rect"}]},{"attrs":{"id":"DD2491FD0BA4FE42C30BA2621D5EBF2F99D1"},"className":"Layer","children":[]},{"attrs":{"id":"7791C975F77EFA44FA7801052B3D72484BC4","name":"layer_three"},"className":"Layer","children":[]}]}';
					stage = Konva.Node.create(tempStr, 'container');
					if(!stage.attrs.type){
					    stage.attrs.type="normal";
					}
					//console.log(stage.attrs);
				}


				layer_grid = stage.getLayers()[0];
				layer = stage.getLayers()[1];
				layer_three = stage.getLayers()[2];
				if (typeof(layer_three) == "undefined") {
					layer_three = new Konva.Layer({
						id: Math.uuid(),
						name: "layer_three"
					});
					stage.add(layer_three);
				}
				var groups = stage.find('Group');
				groups.each(function(group) {
					stageOper.addModuleEvent(group);
					stageOper.setGroupImage(group);
				});

				layer.draw();
				//设置容器的大小
				$("#container").height(stage.height());
				$("#container").width(stage.width());
			}
			var typeHtml="";
			if(stage.attrs.type=="normal"){
			    $("#stageSizeSelect").show();
			    $("#stageSizeSet").hide();
				typeHtml+="<option selected value='normal'>常规画布</option>";
				typeHtml+="<option value='dialog'>弹框画布</option>";
				$("#selectCanvasType").html(typeHtml);
				form.render('select');
				$("#selectCanvasType").val("normal");
			}else{
			    $("#stageSizeSelect").hide();
			    $("#stageSizeSet").show();
				//$("#selectCanvasType").val("dialog");
				typeHtml += "<option  value='normal'>常规画布</option>";
				typeHtml += "<option selected value='dialog'>弹框画布</option>";
			    $("#selectCanvasType").html(typeHtml);
				form.render('select');
				$("#selectCanvasType").val("dialog");
			}

			if (typeof(element) != "undefined") {
				this.element = element; //layui的元素
			}
			this.stage = stage;
			this.layer = layer;
			this.layer_grid = layer_grid;
			this.layer_three = layer_three;

			if(stage.attrs.type=="normal"){
				//$("#selectResolution").val("1920*1080");
			    this.initResolution();
			}else{
				this.initDialogStageSize();
			}
			var that=this;
			//监听画布类型选择
			form.on('select(selectCanvasType)', function(data) {
				if(data.value=="normal"){
				    $("#stageSizeSelect").show();
				    $("#stageSizeSet").hide();
					stage.attrs.type="normal";
					that.initResolution();
				}else{
				    $("#stageSizeSelect").hide();
				    $("#stageSizeSet").show();
	                stage.attrs.type="dialog";
				    that.initDialogStageSize();
					$("#stageSize").val("");
				}
			});
			this.initGuides();
			this.initBackground();
			this.initBackgroundImage(stageObjJsonTemp, moduleStageStatus);
			this.addMouseListens(this.stage); // 鼠标滚轮事件与滚动条重复， 在放大缩小的同时，滚动条也在滚 所以暂时涂掉
			this.addLayerDragMove(); //添加标线
			//组件点击,变换框，拖拉选中事件  回退的时候要从新添加事件
			if (typeof(stageObjJsonTemp) != "undefined") {
				this.addModuleTransformEvent();
				//设置组件右键菜单
				stageOper.addModuleContextmenu();
			}
			//添加可拖动，是从下面(8608行)的键盘事件中移出来的，键盘组合拖动改为直接左键拖动;
			// stageOper.stage.draggable(true);
			// document.body.style.cursor = 'all-scroll';
			// spaceIsDown = true;
			// 处理画面条件弹出框----------------------
			// if (typeof(stage.attrs.conditionInfo) == "undefined") { //如果画面没有这个属性就添加上
			// 	stage.attrs.conditionInfo = {
			// 		conditionType: '0', //默认为空 空为不启用  1启用
			// 		//conditionWhere: [{devicecode:'',devicename:'',min:'',max:'',urlContent:'http://',contentWidth:'800',contentHeight: '600',time:5000}],//弹框条件
			// 		conditionWhere: '' //弹框条件 默认不配置
			// 	};
			// }
			// stageOper.setConditionStage();
		},
		/**
		 * 处理条件弹框
		 */
		setConditionStage: function() {
			//处理是否启用
			var conditionType = this.stage.attrs.conditionInfo.conditionType;
			var conditionWhere = this.stage.attrs.conditionInfo.conditionWhere;
			var conditionOpenHtml = '<option  value="">不启用</option>';
			if (conditionType == 1) {
				conditionOpenHtml += '<option selected value="1">启用</option>';
			} else {
				conditionOpenHtml += '<option  value="1">启用</option>';
			}
			$("#select_conditionSfqy").html(conditionOpenHtml);
			$("#select_conditionSfqy").val(conditionType);
			form.render('select');
			if (conditionWhere != '') {
				$("#tjtkpzqk").val('已配置');
			} else {
				$("#tjtkpzqk").val('未配置');
			}
			//是否启用
			layui.form.on('select(select_conditionSfqy)', function(data) {
				var selectValue = data.value;
				stageOper.stage.attrs.conditionInfo.conditionType = selectValue;
			});
			//弹框配置按钮
			$("#tjtkdjpz").unbind("click");
			$("#tjtkdjpz").bind("click", function() {
				var conditionWhere = stageOper.stage.attrs.conditionInfo.conditionWhere;
				conditionConfig = conditionWhere;
				layer.open({
					title: '请配置弹框条件',
					type: 2,
					area: ['1000px', '700px'],
          skin: 'layer-class',
					fixed: false, //不固定
					maxmin: true,
					content: 'conditionConfig.html',
					end: function(index, layero) {
						//   var hardware_id="";//当前选择的硬件传感器数据点的id
						//    var hardware_Text="";//当前选择的硬件传感器数据点的描述
						if (JSON.stringify(conditionConfig) != "{}") {
							stageOper.stage.attrs.conditionInfo.conditionWhere =
								conditionConfig;
							if (conditionConfig != '') {
								$("#tjtkpzqk").val('已配置');
							} else {
								$("#tjtkpzqk").val('未配置');
							}
						}
					}
				});
			});
		},

		/**
		 * 将模板应用到画面
		 */
		// moduleStageJsonToStage: function(stageJsonId, moduleStageId, moduleName) {
		// 	var moduleStageJson = this.moudleObj[stageJsonId];
		// 	stageModuleName = moduleName;
		// 	if (typeof(moduleStageId) != "undefined") {
		// 		stageModule_id = moduleStageId;
		// 		$("#bcmb").html("修改到模板");
		// 	} else {
		// 		stageModule_id = "";
		// 		$("#bcmb").html("保存到模板");
		// 	}
		// 	this.initStage(undefined, undefined, moduleStageJson, '1');
		// },
		/**
		 * 初始化分辨率
		 */
		initResolution: function() {
			var width = this.stage.width() || 1920;
			var height = this.stage.height() || 1080;
			var stageResolutionArry = initjson.stageResolution;
			var resolutionOptionHtml = "";
			for (var argumentsKey = 0; argumentsKey < stageResolutionArry.length; argumentsKey++) {
				var ResolutionObj = stageResolutionArry[argumentsKey];
				var name = ResolutionObj.name;
				var code = ResolutionObj.value;
				resolutionOptionHtml += " <option value='" + code + "'>" + name + "</option>";
			}
			$("#selectResolution").html(resolutionOptionHtml);
			$("#selectResolution").val(width + "*" + height);
			form.render('select');
			//监听画布分辨率选择
			form.on('select(selectResolution)', function(data) {
				var resolution = new Array();
				resolution = data.value.split("*");
				stageOper.setStageSize({
					width: Number(resolution[0]),
					height: Number(resolution[1])
				});
				//重新画辅助线
				stageOper.setStageGrid($("#hbfzx").is(":checked"));
				//从新设置背景
				stageOper.setStageBackground();
				//背景中如果有图片，图片要 从新铺满
				stageOper.resetStageBackgroundImage();
			});
		},

		//处理弹框画布下的画布大小输入
		initDialogStageSize: function() {
			var width = this.stage.width();
			var height = this.stage.height();
			$("#stageSize").val(width + "*" + height);
			$("#stageSize").change(function(){
				console.log($(this).val());
				var value = $(this).val();
				var resolution = new Array();
				resolution = value.split("*");
				stageOper.setStageSize({
					width: Number(resolution[0]),
					height: Number(resolution[1])
				});
				//重新画辅助线
				stageOper.setStageGrid($("#hbfzx").is(":checked"));
				//从新设置背景
				stageOper.setStageBackground();
				//背景中如果有图片，图片要 从新铺满
				stageOper.resetStageBackgroundImage();
			})
			// form.on('input(stageSize)', function(data) {
			// 	console.log(data);
			// 	var resolution = new Array();
			// 	resolution = data.value.split("*");
			// 	stageOper.setStageSize({
			// 		width: Number(resolution[0]),
			// 		height: Number(resolution[1])
			// 	});
			// 	//重新画辅助线
			// 	stageOper.setStageGrid($("#hbfzx").is(":checked"));
			// 	//从新设置背景
			// 	stageOper.setStageBackground();
			// 	//背景中如果有图片，图片要 从新铺满
			// 	stageOper.resetStageBackgroundImage();

			// })
		},



		/**
		 * 初始化辅助线
		 */
		initGuides: function() {
			var gridLines = this.stage.find('.gridLine');
			if (gridLines.length != 0) {
				$("#hbfzx").prop('checked', true);
				form.render('checkbox');
				$("#gridColorGroup").show();
				var lineColor = gridLines[0].stroke();
				$('#gridColor').val(lineColor);
				//辅助线颜色
				colorpicker.render({
					elem: '#gridColorSelect',
					color: lineColor,
					predefine: true,
					change: function(color) {
						$('#gridColor').val(color);
						stageOper.setGridColor(color);

					}
				});
			} else {
				//辅助线颜色
				$('#gridColor').val('#e3d7ff');
				colorpicker.render({
					elem: '#gridColorSelect',
					color: '#e3d7ff',
					predefine: true,
					change: function(color) {
						$('#gridColor').val(color);
						stageOper.setGridColor(color);

					}
				});
			}
		},
		/**
		 * 初始化背景颜色
		 */
		initBackground: function() {
			var layer_background = this.stage.findOne('.layer_background');
			var colort = layer_background.fill();
			$('#stageBackgroundColor').val(colort);
			//场景背景设置
			colorpicker.render({
				elem: '#stageBackgroundColorSelect',
				color: colort,
				predefine: true,
				alpha: true //开启透明度
					,
				format: 'rgb',
				change: function(color) {
					$('#stageBackgroundColor').val(color);
					//设置场景背颜色
					stageOper.setStageBackground(color);
				}
			});
		},
		/**
		 * 初始化背景图片
		 */
		initBackgroundImage: function(stageObjJsonTemp, moduleStageStatus) {
			var layer_background = this.stage.findOne('.layer_grid'); // 获取背景图层
			var stageWidth = this.stage.width();
			var stageHeight = this.stage.height();
			var urlImage = layer_background.attrs.backgroundImageURL;
			if (typeof(urlImage) != "undefined" && urlImage != "") {
				$("#stageBackgroundImage").attr('src', urlImage);
				//删除原有的 image 组件。
				var nodes = layer_background.find('Image');
				nodes.each(function(node) {
					node.destroy();
				});
				Konva.Image.fromURL(urlImage, function(imageNode) {
					imageNode.name("myShapeBackgroundImage");
					imageNode.width(stageWidth);
					imageNode.height(stageHeight);
					layer_background.add(imageNode);
					//stageOper.stageLayerBackgroundImage = imageNode
					//stageOper.addModuleTransformEvent();
					//moduleObject.draw();
					layer_background.draw();

					if (moduleStageStatus == '1' || (typeof(stageObjJsonTemp) == "undefined" && typeof(
							moduleStageStatus) == "undefined")) { // 模板应用要存到撤销数组
						// 存入到撤销的数组
						setTimeout(function() { // 延时执行，保证图片都已经加载万
							stageOper.stackZfun();
						}, 500);
					}

				}, "config/gyyj/noimg.svg");
			} else {
				$("#stageBackgroundImage").attr('src', "config/gyyj/noimg.svg");
				if (typeof(stageObjJsonTemp) == "undefined" || moduleStageStatus == '1') { // 如果是新增 要存到撤销数组
					// 存入到撤销的数组
					setTimeout(function() { // 延时执行，保证图片都已经加载万
						stageOper.stackZfun();
					}, 500);
				}
			}
		},
		/**
		 * 获取stageJson
		 * @param sizeObj {width:10,height:10}
		 */
		getStageJson: function() {
			try {
				//清除线段编辑
				var GroupObjs = stageOper.layer.find(function(node) {
					return node.attrs.moduleType === 'BASELINE' || node.attrs.moduleType === 'FLOWLINE';
				});
				GroupObjs.each(function(groupObj) {
					var moduleType = groupObj.attrs.moduleType;
					if (moduleType == 'BASELINE') {
						stageOper.removeLineEdit(groupObj);
					}
					if (moduleType == 'FLOWLINE') {
						stageOper.removeFlowLineEdit(groupObj);
					}
				});
				// 清除普通组件编辑
				this.layer_three.find(".transformer")[0].destroy();
				this.layer_three.draw();
			} catch (e) {}
			return this.stage.toJSON();
		},
		/**
		 * 设置画布大小
		 * @param sizeObj {width:10,height:10}
		 */
		setStageSize: function(sizeObj) {
			this.stageMaxMin('restore'); //还原画布比例
			this.stage.width(sizeObj.width);
			this.stage.height(sizeObj.height);
			this.layer_grid.clip({
				x: 0,
				y: 0,
				width: sizeObj.width,
				height: sizeObj.height
			});
			$("#container").height(sizeObj.height);
			$("#container").width(sizeObj.width);
			this.stage.draw();
		},
		/**
		 * 设置画布背景颜色
		 * @param sizeObj {width:10,height:10}
		 */
		setStageBackground: function(color) {
			var layer_background = this.stage.findOne('.layer_background');
			layer_background.width(this.stage.width());
			layer_background.height(this.stage.height());
			if (color == null) {
				color = layer_background.fill();
			}
			layer_background.fill(color);
			this.stage.getLayers()[0].draw();
		},
		/**
		 * 改变分辨率的时候从新将背景图片铺满
		 */
		resetStageBackgroundImage: function() {
			var layer_background = this.stage.findOne('.layer_grid'); // 获取背景图层
			var stageWidth = this.stage.width();
			var stageHeight = this.stage.height();
			var urlImage = layer_background.attrs.backgroundImageURL;
			if (typeof(urlImage) != "undefined" && urlImage != "") {
				var nodes = layer_background.find('Image');
				nodes.each(function(node) {
					node.destroy();
				});
				Konva.Image.fromURL(urlImage, function(imageNode) {
					imageNode.name("myShapeBackgroundImage");
					//imageNode.setAttr("offset",{x: imageNode.width() / 2,y: imageNode.height() / 2});
					imageNode.width(stageWidth);
					imageNode.height(stageHeight);
					layer_background.add(imageNode);
					layer_background.draw();
				}, "config/gyyj/noimg.svg");
			}
		},
		/**
		 * 设置画布背景图片
		 * @param sizeObj {width:10,height:10}
		 */
		setStageBackgroundImage: function(imageUrl) {
			var layer_background = this.stage.findOne('.layer_grid'); // 获取背景图层
			var stageWidth = this.stage.width();
			var stageHeight = this.stage.height();
			layer_background.setAttr("backgroundImageURL", imageUrl);
			var nodes = layer_background.find('Image');
			nodes.each(function(node) {
				node.destroy();
			});
			Konva.Image.fromURL(imageUrl, function(imageNode) {
				imageNode.name("myShapeBackgroundImage");
				//imageNode.setAttr("offset",{x: imageNode.width() / 2,y: imageNode.height() / 2});
				imageNode.width(stageWidth);
				imageNode.height(stageHeight);
				layer_background.add(imageNode);
				layer_background.draw();
			}, "config/gyyj/noimg.svg");

		},
		/**
		 * 删除画布背景图片
		 * @param sizeObj {width:10,height:10}
		 */
		deleteStageBackgroundImage: function() {
			$("#stageBackgroundImage").attr('src', "config/gyyj/noimg.svg");
			var layer_background = this.stage.findOne('.layer_grid'); // 获取背景图层
			layer_background.setAttr("backgroundImageURL", "");
			var nodes = layer_background.find('Image');
			nodes.each(function(node) {
				node.destroy();
			});
			layer_background.draw();
		},
		/**
		 * 设置网格颜色
		 * @param color
		 */
		setGridColor: function(color) {
			var gridLines = this.stage.find('.gridLine');
			gridLines.each(function(line) {
				line.stroke(color);
			});
			this.stage.getLayers()[0].draw();
		},
		/**
		 *添加画布网格，取消画布网格 默认网格间距为10px；
		 * @param isgrid {true（添加网格）|fasle（取消表格）}
		 */
		setStageGrid: function(isgrid) {
			var gridLines = this.stage.find('.gridLine');
			if (!isgrid) {
				gridLines.each(function(line) {
					line.destroy();
				});
				this.stage.getLayers()[0].draw();
				return;
			}
			this.stageMaxMin('restore'); //还原大小缩放
			// 画之前先清掉原有的网格
			if (gridLines.length > 0) {
				gridLines.each(function(line) {
					line.destroy();
				});
			}
			var layerSize = this.stage.getLayers()[0].getSize();
			var stagePosittion = this.stage.position();
			//layerSize.width=layerSize.width-stagePosittion.x;
			// layerSize.height=layerSize.height-stagePosittion.y;

			// console.log(stagePosittion.x+"   "+stagePosittion.y);
			//网格间距
			var span_length = 20;
			//竖线的条数
			var y_line_count = Math.ceil(layerSize.width / span_length);
			//横线线的条数
			var x_line_count = Math.ceil(layerSize.height / span_length);

			//竖线坐标点
			var y_linePointArray = new Array();
			//竖线起点坐标的坐标y

			var y_pointOne_y = -10; //去负数可以传过上边框 视觉上会好些
			if (stagePosittion.y < 0) { //场景移动后的不同情况 y向上移动
				y_pointOne_y = 0 - (stagePosittion.y) - 10;
			}
			if (stagePosittion.y > 0) { //场景移动后的不同情况 y向下移动
				y_pointOne_y = 0 - (stagePosittion.y) - 10;
			}
			if (stagePosittion.y == 0) { //场景移动后的不同情况 没有移动
			}
			//竖线终点坐标点的坐标y
			var y_pointTow_y = x_line_count * span_length - stagePosittion.y;
			//横线坐标点
			var x_linePointArray = new Array();
			//横线起点坐标的坐标x
			var x_pointOne_x = -10; //去负数可以传过上边框 视觉上会好些
			if (stagePosittion.x < 0) { //场景移动后的不同情况 x向上移动
				x_pointOne_x = 0 - (stagePosittion.x) - 10;
			}
			if (stagePosittion.x > 0) { //场景移动后的不同情况 x向下移动
				x_pointOne_x = 0 - (stagePosittion.x) - 10;
			}
			if (stagePosittion.x == 0) { //场景移动后的不同情况 没有移动
			}
			//横线终点坐标点的坐标x
			var x_pointTow_x = y_line_count * span_length - stagePosittion.x;

			//竖线循环得到坐标
			for (var i = 1; i < y_line_count; i++) {
				//竖线起点坐标X
				var pointOne_x = i * span_length - stagePosittion.x;
				//竖线终点坐标x
				var pointTow_x = pointOne_x;

				if (i % 2 == 0) {
					// 偶数
					y_linePointArray.push(pointTow_x + 0.5, y_pointTow_y + 0.5, pointOne_x + 0.5, y_pointOne_y +
						0.5);
				} else {
					// 奇数
					y_linePointArray.push(pointOne_x + 0.5, y_pointOne_y + 0.5, pointTow_x + 0.5, y_pointTow_y +
						0.5);
				}
			}
			//横线循环得到坐标
			for (var i = 1; i < x_line_count; i++) {
				//横线起点坐标y
				var pointOne_y = i * span_length - stagePosittion.y;
				//横线终点坐标y
				var pointTow_y = pointOne_y;

				if (i % 2 == 0) {
					// 偶数
					x_linePointArray.push(x_pointTow_x + 0.5, pointTow_y + 0.5, x_pointOne_x + 0.5, pointOne_y +
						0.5);
				} else {
					// 奇数
					x_linePointArray.push(x_pointOne_x + 0.5, pointOne_y + 0.5, x_pointTow_x + 0.5, pointTow_y +
						0.5);
				}
			}


			//竖线对象
			var y_line_obj = new Konva.Line({
				points: y_linePointArray,
				stroke: '#e3d7ff',
				strokeWidth: 1,
				lineCap: 'round',
				lineJoin: 'round',
				strokeScaleEnabled: false,
				name: 'gridLine'
			});
			//横线对象
			var x_line_obj = new Konva.Line({
				points: x_linePointArray,
				stroke: '#e3d7ff',
				strokeWidth: 1,
				lineCap: 'round',
				lineJoin: 'round',
				strokeScaleEnabled: false,
				name: 'gridLine'
			});

			//以下是0点坐标.

			//竖线起点的坐标的x
			var zero_y_line_start_x = 0;
			//竖线起点的坐标的y
			var zero_y_line_start_y = 0 - stagePosittion.y;

			//竖线终点的坐标的x
			var zero_y_line_end_x = 0;
			//竖线终点的坐标的y
			var zero_y_line_end_y = layerSize.height - stagePosittion.y;

			//横线起点的坐标的x
			var zero_x_line_start_x = 0 - stagePosittion.x;
			//横线起点的坐标的y
			var zero_x_line_start_y = 0;

			//横线终点的坐标的x
			var zero_x_line_end_x = layerSize.width - stagePosittion.x;
			//横线终点的坐标的y
			var zero_x_line_end_y = 0;

			//竖线对象
			var zero_y_line_obj = new Konva.Line({
				points: [zero_y_line_start_x, zero_y_line_start_y, zero_y_line_end_x,
					zero_y_line_end_y
				],
				stroke: '#dfc7ff',
				strokeWidth: 2,
				lineCap: 'round',
				lineJoin: 'round',
				strokeScaleEnabled: false,
				name: 'gridLine'

			});
			//横线对象
			var zero_x_line_obj = new Konva.Line({
				points: [zero_x_line_start_x, zero_x_line_start_y, zero_x_line_end_x,
					zero_x_line_end_y
				],
				stroke: '#dfc7ff',
				strokeWidth: 2,
				lineCap: 'round',
				lineJoin: 'round',
				strokeScaleEnabled: false,
				name: 'gridLine'
			});






			this.stage.getLayers()[0].add(y_line_obj);
			this.stage.getLayers()[0].add(x_line_obj);
			this.stage.getLayers()[0].add(zero_y_line_obj);
			this.stage.getLayers()[0].add(zero_x_line_obj);
			this.stage.getLayers()[0].batchDraw();

		},
		/**
		 * 设置场景拖动
		 * @param isDrag true 可拖动，false不可拖动
		 */
		setStageDrag: function(isDrag) {
			this.stage.draggable(isDrag);
		},


		/**
		 * 设置左边组件面板（图纸组件） MapStorage
		 * @param moduleJson
		 */
		setLeftDrawsModulePanel: function(modulJson) {
			var modulePanelHtml = "";

			//图纸名字
			var groupname = "图纸";
			var moduleItem = modulJson;
			modulePanelHtml += " <div class=\"layui-colla-item\">";
			modulePanelHtml += "<h2 class=\"layui-colla-title\">" + groupname +
				"<input id='add_MyDraw'  class='layui-btn layui-btn-primary' type='button' style='float: right;font-size: 33px;height: 42px;line-height: 42px;' value='+'></h2>";
			modulePanelHtml += "<div class=\"layui-colla-content layui-show\" style=\"padding: 5px\">";
			modulePanelHtml +=
				"<div class=\"module_panel\" style='display: flex;justify-content:flex-start; align-items:flex-start;flex-direction: column;'>";
			moduleItem.forEach(function(item) {
				var moduleName = item.draw_name;
				var iconBase64 = (item.draw_thumb && item.draw_thumb != "null") ?
					baseUrl + item.draw_thumb : "config/gyyj/noimg.svg";
				//iconBase64="http://api.ykiot.net/uploads/images/20210206/5517f927f8ab734242d579cc8df0e606.png";
				var moduleJsonObj = "";
				// var moduleJsonObj = {"attrs":{"draggable":true,"name":"jyzt_module_group","moduleType":"SVG","imageURL":iconBase64,"hideMethodCall":"hideModule","hideWhere":"[{devicecode:'',devicename:'',min:'',max:''}]","sparklingMethodCall":"sparklingModule","sparklingWhere":"[{devicecode:'',devicename:'',min:'',max:''}]","moduleAttr":[{"attrName":"隐藏条件","attrCode":"hideWhere","attrType":"hideTable","attrWhere":"this"},{"attrName":"闪烁条件","attrCode":"sparklingWhere","attrType":"sparklingTable","attrWhere":"this"}]},"className":"Group","children":[{"attrs":{},"className":"Image"}]};
				var imgid = Math.uuid();
				this.moudleObj[imgid] = JSON.stringify(moduleJsonObj);
				modulePanelHtml +=
					"<div class=\"module_img_d\" style='width:100%;position:relative;border-bottom:1px solid #bbb;display: flex;justify-content:flex-start; align-items: flex-end;flex-direction:row;'>";
				modulePanelHtml += '<img   id="' + imgid +
					'" style="cursor:pointer;height:40px;width:40px;margin-bottom:4px;" onclick="changeDraw(' +
					item.id + ')" class="module_img" src="' + iconBase64 + '">';
				if ($_GET.stageId == item.id) {
					//console.log($_GET.stageId);
					modulePanelHtml +=
						'<span style="position:absolute;top:0;left:49px;color:deepskyblue;">' +
						moduleName + '</span>'
				} else {
					modulePanelHtml +=
						'<span style="position:absolute;top:0;left:49px;color:#111;cursor:pointer;" id=' +
						item.id + ' onmouseover="changeTextColor(' + item.id +
						',0)"  onmouseout="changeTextColor(' + item.id + ',1)"  onclick="changeDraw(' +
						item.id + ')">' + moduleName + '</span>'
				}
				modulePanelHtml += "<input name='editMyDraw' id='" + item.id +
					"'  class='layui-btn layui-btn-primary' type='button' style='font-size:12px;height:20px;width:auto;padding:0 4px;line-height:20px;margin-left:5px;margin-bottom:4px;border:none;background-color:transparent;color:#409EFF;' onclick='changeDraw(" +
					item.id + ")' value='绘制'>";
				modulePanelHtml += "<input name='infoMyDraw' id='" + item.id +
					"'  class='layui-btn layui-btn-primary' type='button' style='font-size:12px;height:20px;width:auto;padding:0 4px;line-height:20px;margin-bottom:4px;border:none;background-color:transparent;color:#409EFF;' value='设置'>";
				modulePanelHtml += "<input name='copyMyDraw' id='" + item.id + '@' + item.draw_name +
					"'  class='layui-btn layui-btn-primary' type='button' style='font-size:12px;height:20px;width:auto;padding:0 4px;line-height:20px;margin-bottom:4px;border:none;background-color:transparent;color:#409EFF;' value='复制'>";
				if (moduleItem.length > 1) {
					modulePanelHtml += "<input name='deleteMyDraw' id='" + item.id +
						"'  class='layui-btn layui-btn-primary' type='button' style='font-size:12px;color:#cc0000;height:20px;width:auto;padding:0 4px;line-height:20px;margin-right:5px;margin-bottom:4px;border:none;background-color:transparent;' value='删除'>";
				}
				modulePanelHtml += "</div>";
			}, this);

			modulePanelHtml += "</div>";
			modulePanelHtml += "</div>";
			modulePanelHtml += "</div>";

			$(".main_page_center .main_page_center_left .layui-tab .layui-tab-content .layui-tab-item .drawsmodule ")
				.html(modulePanelHtml);
			this.element.render("collapse", "module_panel");
			$("#add_MyDraw").click(function(event) {
				event.stopPropagation();
				layer.open({
					title: '添加图纸',
					type: 2,
					area: ['500px', '450px'],
          skin: 'layer-class',
					fixed: false, //不固定
					maxmin: true,
					//content: 'uploadImage.html?userId='+userId,
					content: 'addDraw.html',
					end: function(index, layero) {
						var module_base = eval("initConfig." + initjson
							.initDrawsMoudleFunction + "()");
						stageOper.setLeftDrawsModulePanel(module_base);
					}

				});

			});

			$("input[name='infoMyDraw']").click(function(event) {
				var drawId = this.id;
				//localStorage.setItem("infoDrawId", this.id);
				event.stopPropagation();
				layer.open({
					title: '设置图纸',
					type: 2,
					area: ['500px', '450px'],
          skin: 'layer-class',
					fixed: false, //不固定
					maxmin: true,
					//content: 'uploadImage.html?userId='+userId,
					content: 'infoDraw.html?draw_id=' + drawId,
					end: function(index, layero) {
						var module_base = eval("initConfig." + initjson
							.initDrawsMoudleFunction + "()");
						stageOper.setLeftDrawsModulePanel(module_base);
					}

				});

			});

			$("input[name='copyMyDraw']").click(function(event) {
				// localStorage.setItem("infoDrawId", this.id);
				var drawId = this.id.split('@')[0];
				var drawName = this.id.split('@')[1];
				event.stopPropagation();
				layer.open({
					title: '复制图纸-' + drawName,
					type: 2,
					area: ['500px', '470px'],
          skin: 'layer-class',
					fixed: false, //不固定
					maxmin: true,
					//content: 'uploadImage.html?userId='+userId,
					content: 'copyDraw.html?draw_id=' + drawId,
					end: function(index, layero) {
						var module_base = eval("initConfig." + initjson
							.initDrawsMoudleFunction + "()");
						stageOper.setLeftDrawsModulePanel(module_base);
					}

				});

			});

			$("input[name='deleteMyDraw']").bind("click", function(e) {
				var moduleId = this.id;

				layer.confirm('确定要删除吗', function(index) {
					eval("initConfig." + initjson.deleteMyDrawFunction + "(moduleId)");

					layer.close(index);
				});
			});
		},

		/**
		 * 设置左边组件面板（基础组件）
		 * @param moduleJson
		 */
		setLeftModulePanel: function(moduleJson) {
			var modulePanelHtml = "";
			for (var i = 0; i < moduleJson.length; i++) {
				//分组名字
				var groupname = moduleJson[i].groupName;
				var moduleItem = moduleJson[i].moduleItem;
				modulePanelHtml += " <div class=\"layui-colla-item\">";
				modulePanelHtml += "<h2 class=\"layui-colla-title\">" + groupname + "</h2>";
				if (i == 0) { //第一个展开
					modulePanelHtml += "<div class=\"layui-colla-content layui-show\" style=\"padding: 5px\">";
				} else {
					modulePanelHtml += "<div class=\"layui-colla-content\" style=\"padding: 5px\">";
				}

				modulePanelHtml += "<div class=\"module_panel\">";
				for (var j = 0; j < moduleItem.length; j++) {
					var moduleName = moduleItem[j].moduleName;
					var iconBase64 = moduleItem[j].iconBase64;
					var moduleJsonObj = moduleItem[j].moduleJson;
					var imgid = Math.uuid();
					this.moudleObj[imgid] = moduleJsonObj;
					modulePanelHtml +=
						"<div class=\"module_img_d\" style='display: flex;justify-content:flex-end; align-items: center;flex-direction: column;'>";
					//modulePanelHtml+="<input type='hidden' value='"+moduleJsonObj+"'  />";
					modulePanelHtml += "<img alt='" + moduleName + "' id='" + imgid +
						"' style='cursor:move' draggable='true' ondragstart='dragImage(event)'  class=\"module_img\"  src=\"" +
						iconBase64 + "\">";
					modulePanelHtml += "<div class='module_img_text'>" + moduleName + "</div>";
					modulePanelHtml += "</div>";

				}

				modulePanelHtml += "</div>";
				modulePanelHtml += "</div>";
				modulePanelHtml += "</div>";
			}

			$(".main_page_center .main_page_center_left .layui-tab .layui-tab-content .layui-tab-item .basemodule ")
				.html(modulePanelHtml);
			this.element.render("collapse", "module_panel");


		},
		/**
		 * 设置左边组件面板（画面装饰）
		 * @param moduleJson
		 */
		setLeftModuleDecorationPanel: function(moduleJson) {
			var modulePanelHtml = "";
			for (var i = 0; i < moduleJson.length; i++) {
				//分组名字
				var groupname = moduleJson[i].groupName;
				var moduleItem = moduleJson[i].moduleItem;
				modulePanelHtml += " <div class=\"layui-colla-item\">";
				modulePanelHtml += "<h2 class=\"layui-colla-title\">" + groupname + "</h2>";
				if (i == 0) { //第一个展开
					modulePanelHtml += "<div class=\"layui-colla-content layui-show\" style=\"padding: 5px\">";
				} else {
					modulePanelHtml += "<div class=\"layui-colla-content\" style=\"padding: 5px\">";
				}

				modulePanelHtml += "<div class=\"module_panel\">";
				for (var j = 0; j < moduleItem.length; j++) {
					var moduleName = moduleItem[j].moduleName;
					var iconBase64 = moduleItem[j].iconBase64;
					var moduleJsonObj = moduleItem[j].moduleJson;
					var imgid = Math.uuid();
					this.moudleObj[imgid] = moduleJsonObj;
					modulePanelHtml +=
						"<div class=\"module_img_d\" style='display: flex;justify-content:flex-end; align-items: center;flex-direction: column;'>";
					//modulePanelHtml+="<input type='hidden' value='"+moduleJsonObj+"'  />";
					modulePanelHtml += "<img alt='" + moduleName + "' id='" + imgid +
						"' style='cursor:move' draggable='true' ondragstart='dragImage(event)'  class=\"module_img\"  src=\"" +
						iconBase64 + "\">";
					modulePanelHtml += "<div class='module_img_text'>" + moduleName + "</div>";
					modulePanelHtml += "</div>";

				}

				modulePanelHtml += "</div>";
				modulePanelHtml += "</div>";
				modulePanelHtml += "</div>";
			}

			if (moduleJson == "") {
				modulePanelHtml = "该版本无此项内容"
			}

			$(".main_page_center .main_page_center_left .layui-tab .layui-tab-content .layui-tab-item .decoration ")
				.html(modulePanelHtml);
			this.element.render("collapse", "module_panel");


		},
		// /**
		//  * 设置左边组件面板（画面模板）
		//  * @param moduleJson
		//  */
		// setLeftModulestagePanel: function(moduleJson) {
		// 	var modulePanelHtml = "";
		// 	for (var i = 0; i < moduleJson.length; i++) {
		// 		//分组名字
		// 		var groupname = moduleJson[i].groupName;
		// 		var moduleItem = moduleJson[i].moduleStageItem;
		// 		modulePanelHtml += " <div class=\"layui-colla-item\">";
		// 		modulePanelHtml += "<h2 class=\"layui-colla-title\">" + groupname + "</h2>";
		// 		if (i == 0) { //第一个展开
		// 			modulePanelHtml += "<div class=\"layui-colla-content layui-show\" style=\"padding: 5px\">";
		// 		} else {
		// 			modulePanelHtml += "<div class=\"layui-colla-content\" style=\"padding: 5px\">";
		// 		}

		// 		modulePanelHtml += "<div class=\"module_panel\">";
		// 		for (var j = 0; j < moduleItem.length; j++) {
		// 			var moduleName = moduleItem[j].moduleName;
		// 			var iconBase64 = moduleItem[j].iconBase64;
		// 			var moduleJsonObj = moduleItem[j].moduleStageJson;
		// 			var imgid = Math.uuid();
		// 			this.moudleObj[imgid] = moduleJsonObj;
		// 			modulePanelHtml +=
		// 				"<div class=\"moduleStage_img_d\" style='display: flex;justify-content:flex-end; align-items: center;flex-direction: column;'>";
		// 			//modulePanelHtml+="<input type='hidden' value='"+moduleJsonObj+"'  />";
		// 			modulePanelHtml += "<img alt='" + moduleName + "' id='" + imgid +
		// 				"'   class=\"moduleStage_img\"  src=\"" + iconBase64 + "\">";
		// 			modulePanelHtml += "<div class='module_img_text'>" + moduleName + "</div>";
		// 			modulePanelHtml += "<button onclick=stageOper.moduleStageJsonToStage(\'" + imgid +
		// 				"\',undefined,\'" + moduleName +
		// 				"\') class='layui-btn layui-btn-normal'>应用到画面</button>";
		// 			modulePanelHtml += "</div>";

		// 		}

		// 		modulePanelHtml += "</div>";
		// 		modulePanelHtml += "</div>";
		// 		modulePanelHtml += "</div>";
		// 	}

		// 	if (moduleJson == "") {
		// 		modulePanelHtml = "该版本无此项内容"
		// 	}

		// 	$(".main_page_center .main_page_center_left .layui-tab .layui-tab-content .layui-tab-item .ScreenTemplate ")
		// 		.html(modulePanelHtml);
		// 	this.element.render("collapse", "module_panel");


		// },
		/**
		 * 设置左边组件面板（图库组件）
		 * @param moduleJson
		 */
		setLeftMapStorageModulePanel: function(moduleJson) {
			var modulePanelHtml = "";
			for (var i = 0; i < moduleJson.length; i++) {
				//分组名字
				var groupname = moduleJson[i].groupName;
				var moduleItem = moduleJson[i].moduleItem;
				modulePanelHtml += " <div class=\"layui-colla-item\">";
				modulePanelHtml += "<h2 class=\"layui-colla-title\">" + groupname + "</h2>";
				if (i == 0) { //第一个展开
					modulePanelHtml += "<div class=\"layui-colla-content layui-show\" style=\"padding: 5px\">";
				} else {
					modulePanelHtml += "<div class=\"layui-colla-content\" style=\"padding: 5px\">";
				}

				modulePanelHtml += "<div class=\"module_panel\">";
				for (var j = 0; j < moduleItem.length; j++) {
					var moduleName = moduleItem[j].moduleName;
					var iconBase64 = moduleItem[j].iconBase64;
					var moduleJsonObj = moduleItem[j].moduleJson;
					var imgid = Math.uuid();
					this.moudleObj[imgid] = moduleJsonObj;
					modulePanelHtml +=
						"<div class=\"module_img_d\" style='display: flex;justify-content:safe center; align-items: center;'>";
					//modulePanelHtml+="<input type='hidden' value='"+moduleJsonObj+"'  />";
					modulePanelHtml += "<img id='" + imgid +
						"' style='cursor:move' draggable='true' ondragstart='dragImage(event)'  class=\"module_img\"  src=\"" +
						iconBase64 + "\">";
					modulePanelHtml += "</div>";

				}

				modulePanelHtml += "</div>";
				modulePanelHtml += "</div>";
				modulePanelHtml += "</div>";
			}

			$(".main_page_center .main_page_center_left .layui-tab .layui-tab-content .layui-tab-item .mapStorageModule ")
				.html(modulePanelHtml);
			this.element.render("collapse", "module_panel");


		},
		/**
		 * 设置左边组件面板（我的图库）
		 * @param moduleJson
		 */
		setLeftMyModulePanel: function(moduleJson) {
			var modulePanelHtml = "";
			//分组名字
			var groupname = '我的图库';

			modulePanelHtml += " <div class=\"layui-colla-item\">";
			modulePanelHtml += "<h2 class=\"layui-colla-title\">" + groupname +
				"<input id='add_MyModual'  class='layui-btn layui-btn-primary' type='button' style='float: right;font-size: 33px;height: 42px;line-height: 42px;' value='+'></h2>";

			modulePanelHtml += "<div class=\"layui-colla-content layui-show\" style=\"padding: 5px\">";

			modulePanelHtml += "<div class=\"module_panel\">";
			for (var j = 0; j < moduleJson.length; j++) {
				//var moduleName = moduleJson[j].moduleName;
				var moduleName = "";
				var iconBase64 = baseUrl + moduleJson[j].file_path;
				//统一.gif和.Gif及.GIF
				var lowerCase = moduleJson[j].file_path.toLowerCase();
				if (lowerCase.indexOf('.gif') >= 0) {
					var moduleJsonObj =
						"{\"attrs\":{\"draggable\":true,\"name\":\"jyzt_module_group\",\"moduleType\":\"GIF\",\"imageURL\":\"" +
						iconBase64 +
						"\",\"hideMethodCall\":\"hideModule\",\"hideWhere\":\"[{devicecode:'',devicename:'',min:'',max:''}]\",\"sparklingMethodCall\":\"sparklingModule\",\"sparklingWhere\":\"[{devicecode:'',devicename:'',min:'',max:''}]\",\"moduleAttr\":[{\"attrName\":\"隐藏条件\",\"attrCode\":\"hideWhere\",\"attrType\":\"hideTable\",\"attrWhere\":\"this\"},{\"attrName\":\"闪烁条件\",\"attrCode\":\"sparklingWhere\",\"attrType\":\"sparklingTable\",\"attrWhere\":\"this\"}]},\"className\":\"Group\",\"children\":[{\"attrs\":{},\"className\":\"Image\"}]}";
					//以下是不带隐藏和闪烁属性的
					//var moduleJsonObj = "{\"attrs\":{\"draggable\":true,\"name\":\"jyzt_module_group\",\"moduleType\":\"GIF\",\"imageURL\":\""+iconBase64+"\"},\"className\":\"Group\",\"children\":[{\"attrs\":{},\"className\":\"Image\"}]}";
				} else {
					var moduleJsonObj =
						"{\"attrs\":{\"draggable\":true,\"name\":\"jyzt_module_group\",\"moduleType\":\"IMAGES\",\"imageURL\":\"" +
						iconBase64 +
						"\",\"hideMethodCall\":\"hideModule\",\"hideWhere\":\"[{devicecode:'',devicename:'',min:'',max:''}]\",\"sparklingMethodCall\":\"sparklingModule\",\"sparklingWhere\":\"[{devicecode:'',devicename:'',min:'',max:''}]\",\"moduleAttr\":[{\"attrName\":\"隐藏条件\",\"attrCode\":\"hideWhere\",\"attrType\":\"hideTable\",\"attrWhere\":\"this\"},{\"attrName\":\"闪烁条件\",\"attrCode\":\"sparklingWhere\",\"attrType\":\"sparklingTable\",\"attrWhere\":\"this\"}]},\"className\":\"Group\",\"children\":[{\"attrs\":{},\"className\":\"Image\"}]}"
					//以下是不带隐藏和闪烁属性的
					//var moduleJsonObj = "{\"attrs\":{\"draggable\":true,\"name\":\"jyzt_module_group\",\"moduleType\":\"IMAGES\",\"imageURL\":\""+iconBase64+"\"},\"className\":\"Group\",\"children\":[{\"attrs\":{},\"className\":\"Image\"}]}";
				}
				var moduleId = moduleJson[j].id;
				var imgid = Math.uuid();
				this.moudleObj[imgid] = moduleJsonObj;
				modulePanelHtml +=
					"<div class=\"module_img_d\" style='display: flex;justify-content:safe center; align-items: center;flex-direction: column;'>";
				modulePanelHtml += "<img alt='" + moduleName + "' id='" + imgid +
					"' style='cursor:move;max-height:50px;max-width:50px;' draggable='true' ondragstart='dragImage(event)'  class=\"module_img\"  src=\"" +
					iconBase64 + "\">";
				modulePanelHtml += "<input name='deleteMyModual' id='" + moduleId +
					"'  class='layui-btn layui-btn-normal' type='button' style='font-size:18px;height:18px;line-height:18px;padding: 0px' value='－'>";
				modulePanelHtml += "</div>";

			}

			modulePanelHtml += "</div>";
			modulePanelHtml += "</div>";
			modulePanelHtml += "</div>";


			$(".main_page_center .main_page_center_left .layui-tab .layui-tab-content .layui-tab-item .myMapStorageModule ")
				.html(modulePanelHtml);
			this.element.render("collapse", "module_panel");
			$("#add_MyModual").click(function(event) {
				event.stopPropagation();
				layer.open({
					title: '添加图片<span style="color:#ff0000">(支持格式为jpg/jpeg/png/gif,大小不超过500kb)</span>',
					type: 2,
					area: ['600px', '400px'],
          skin: 'layer-class',
					fixed: false, //不固定
					maxmin: true,
					//content: 'uploadImage.html?userId='+userId,
					content: 'uploadImage.html',
					end: function(index, layero) {

						//var module_base = eval("initConfig."+initjson.initMyMoudleFunction+"(userId)");
						var module_base = eval("initConfig." + initjson
							.initMyMoudleFunction + "()");
						stageOper.setLeftMyModulePanel(module_base);




					}

				});

			});
			$("input[name='deleteMyModual']").bind("click", function(e) {
				var moduleId = this.id;

				layer.confirm('确定要删除吗', function(index) {
					//eval("initConfig."+initjson.delteMyMoudleFunction+"(userId,moduleId)");
					eval("initConfig." + initjson.delteMyMoudleFunction + "(moduleId)");

					layer.close(index);
				});
			});
		},

		/**
		 * 设置左边组件面板（画面模板--我的模板）
		 * @param moduleJson
		 */
		// setLeftMyModuleStageJsonPanel: function(moduleItem) {
		// 	var modulePanelHtml = "";
		// 	//分组名字
		// 	var groupname = '我的模板';

		// 	modulePanelHtml += " <div class=\"layui-colla-item\">";
		// 	modulePanelHtml += "<h2 class=\"layui-colla-title\">" + groupname +
		// 		"<input id='new_MyModualStage' tipsMess=\"新建模板\"   class='layui-btn layui-btn-primary butTips' type='button' style='float: right;font-size: 33px;height: 42px;line-height: 42px;' value='+'></h2>";
		// 	modulePanelHtml += "<div class=\"layui-colla-content layui-show\" style=\"padding: 5px\">";

		// 	modulePanelHtml += "<div class=\"module_panel\">";
		// 	for (var j = 0; j < moduleItem.length; j++) {
		// 		var moduleStageId = moduleItem[j].moduleStageId;
		// 		var moduleName = moduleItem[j].moduleName;
		// 		var iconBase64 = moduleItem[j].iconBase64;
		// 		var moduleJsonObj = moduleItem[j].moduleStageJson;
		// 		var imgid = Math.uuid();
		// 		this.moudleObj[imgid] = moduleJsonObj;
		// 		modulePanelHtml +=
		// 			"<div class=\"moduleStage_img_d\" style='display: flex;justify-content:flex-end; align-items: center;flex-direction: column;'>";
		// 		//modulePanelHtml+="<input type='hidden' value='"+moduleJsonObj+"'  />";
		// 		modulePanelHtml += "<img alt='" + moduleName + "' id='" + imgid +
		// 			"'   class=\"moduleStage_img\"  src=\"" + iconBase64 + "\">";
		// 		modulePanelHtml += "<div class='module_img_text'>" + moduleName + "</div>";
		// 		modulePanelHtml += "<div>";
		// 		modulePanelHtml += "<button onclick=stageOper.moduleStageJsonToStage(\'" + imgid + "\',\'" +
		// 			moduleStageId + "\',\'" + moduleName +
		// 			"\') class='layui-btn layui-btn-normal' style='padding: 0 10px;'>应用</button>";
		// 		modulePanelHtml += "<button name='deleteMyModuleStage' id = " + moduleStageId +
		// 			" class='layui-btn layui-btn-danger' style='padding: 0 10px;'>删除</button>";
		// 		modulePanelHtml += "</div>";
		// 		modulePanelHtml += "</div>";

		// 	}
		// 	modulePanelHtml += "</div>";
		// 	modulePanelHtml += "</div>";
		// 	modulePanelHtml += "</div>";

		// 	$(".main_page_center .main_page_center_left .layui-tab .layui-tab-content .layui-tab-item .ScreenTemplateMy ")
		// 		.html(modulePanelHtml);

		// 	this.element.render("collapse", "module_panel");
		// 	$("#new_MyModualStage").click(function(event) {
		// 		event.stopPropagation();

		// 		stageModule_id = "";
		// 		$("#bcmb").html("保存到模板");
		// 		var moduleStageJson =
		// 			'{"attrs":{"width":1920,"height":1080,"id":"83010349F624C448742856E548B674E1735F"},"className":"Stage","children":[{"attrs":{"name":"layer_grid","id":"D37F1131FC9D9947EFAAF7C11FF3D3FD1513","clipX":0,"clipY":0,"clipWidth":1920,"clipHeight":1080},"className":"Layer","children":[{"attrs":{"stroke":"#000000","width":1920,"height":1080,"fill":"rgba(227, 238, 242, 1)","listening":false,"strokeWidth":0,"name":"layer_background"},"className":"Rect"}]},{"attrs":{"id":"F0D289B741798C4D027A94FAEC47EF2A5E40"},"className":"Layer","children":[]}]}';
		// 		stageOper.initStage(undefined, undefined, moduleStageJson, '1');



		// 	});

		// 	$("button[name='deleteMyModuleStage']").bind("click", function(e) {
		// 		var moduleStageId = this.id;

		// 		layer.confirm('确定要删除吗', {
		// 			offset: 'l'
		// 		}, function(index) {
		// 			eval("initConfig." + initjson.delteMyMoudleStageFunction + "(UrlParam,'" +
		// 				moduleStageId + "')");

		// 			layer.close(index);
		// 		});
		// 	});

		// },
		/**
		 *
		 *
		 * @param moduleJson
		 * @param modulePoint 位置 ，左边拖过来的时候使用
		 * @param isCopy 是不是按复制时调用的 true 是
		 * @param index 当前复制的第几个
		 * @param size  要复制的总个数
		 * @returns {moduleJsonTemp}
		 */
		addModuleToStage: function(moduleJson, modulePoint, isCopy, index, size) {
			$("#zjsx").html(""); //清除属性面板
			//组件如果是字符串的添加基础信息
			var moduleJsonTemp;
			if (typeof(moduleJson) == 'string' && isCopy != true) { // 是字符串，并且不是复制的
				moduleJsonTemp = eval("(" + moduleJson + ")");
				var moduleType = moduleJsonTemp.attrs.moduleType;


				// moduleJsonTemp.attrs.moduleAttr.push({
				// 	attrName: '组件位置与大小',
				// 	attrCode: 'NONE',
				// 	attrType: 'modulePosition',
				// 	attrWhere: 'this'
				// });
				//网页、监控、高级监控、、视频播放，echart组件、天气 没有基础信息配置
				//2023.4.13新增了文本，复位，跳转，写值，变量1，变量2，开关没有基础信息设置
				if (moduleType != 'lableText' &&  moduleType != 'RESET' && moduleType != 'BUTTON' && moduleType != 'BUTTONVALUE' && moduleType != 'VALUE' && moduleType != 'TextLableValue' && moduleType != 'IMAGES_SWITCH' && moduleType != 'HTML_IFRAME' && moduleType != 'DATA_IFRAME' && moduleType != 'MAP_IFRAME' && moduleType !='HISTORY_IFRAME' && moduleType != 'LIVE_IMAGES' && moduleType !=
					'MONITOR_IMAGES' && moduleType != 'SPBF_IMAGES' &&
					moduleType.indexOf("ECHART") == -1 && moduleType.indexOf("WEATHER") == -1) {

					moduleJsonTemp.attrs.basicInfo = {
						showType: '', //默认空不展示
						closeViewType:'0',  //如果展示的为图纸，图纸的关闭方式
						showContent: [{
							title: "",
							type: 1,
							value: ""
						}]

					};

					moduleJsonTemp.attrs.moduleAttr.push({
						attrName: '鼠标悬停信息',
						attrCode: 'basicInfo',
						attrType: 'BasicInfo',
						attrWhere: 'this'
					});


				}
				//网页、监控、高级监控、视频播放，echart组件、天气，变量1，变量2，写值，按钮，画面跳转，脉冲信号 没有点击弹框功能
				// if (moduleType != 'HTML_IFRAME' && moduleType != 'LIVE_IMAGES' && moduleType !=
				// 	'MONITOR_IMAGES' && moduleType != 'SPBF_IMAGES' &&
				// 	moduleType.indexOf("ECHART") == -1 && moduleType.indexOf("WEATHER") == -1 && moduleType !=
				// 	'TextLableValue' && moduleType != 'VALUE' &&
				// 	moduleType != 'BUTTON' &&
				// 	moduleType != 'BUTTONVALUE' &&
				// 	moduleType != 'BUTTON_JUMP' &&
				// 	moduleType != 'BUTTON_IMPULSES' &&
				// 	moduleType != 'IMAGES_SWITCH'
				// ) {
				// 	moduleJsonTemp.attrs.clickInfo = {
				// 		clickType: '', //默认为空 空为不启用  1启用
				// 		urlContent: 'http://', //弹框出现时要展示的url
				// 		contentWidth: '800', //弹框的宽
				// 		contentHeight: '600' //弹框的高

				// 	};
				// 	moduleJsonTemp.attrs.moduleAttr.push({
				// 		attrName: '鼠标点击弹框',
				// 		attrCode: 'clickInfo',
				// 		attrType: 'ClickInfo',
				// 		attrWhere: 'this'
				// 	});
				// }



			} else {
				if (isCopy == true) {
					moduleJsonTemp = moduleJson;
				} else {
					var moduleJson_str = JSON.stringify(moduleJson);
					var moduleJson_Obj = eval("(" + moduleJson_str + ")");
					var moduleType = moduleJson_Obj.attrs.moduleType;
					// moduleJson_Obj.attrs.moduleAttr.push({
					// 	attrName: '组件位置与大小',
					// 	attrCode: 'NONE',
					// 	attrType: 'modulePosition',
					// 	attrWhere: 'this'
					// });

					//网页、监控、高级监控、视频播放、echart组件、天气 没有基础信息配置
					//2023.4.13新增了文本，复位，跳转，写值，变量1，变量2，开关没有基础信息设置
					if (moduleType != 'lableText' &&  moduleType != 'RESET' && moduleType != 'BUTTON' && moduleType != 'BUTTONVALUE' && moduleType != 'VALUE' && moduleType != 'TextLableValue' && moduleType != 'IMAGES_SWITCH' && moduleType != 'HTML_IFRAME' && moduleType != 'DATA_IFRAME' && moduleType != 'MAP_IFRAME' && moduleType !='HISTORY_IFRAME' && moduleType != 'LIVE_IMAGES' && moduleType !=
						'MONITOR_IMAGES' && moduleType != 'SPBF_IMAGES' &&
						moduleType.indexOf("ECHART") == -1 && moduleType.indexOf("WEATHER") == -1) {
						moduleJson_Obj.attrs.basicInfo = {
							showType: '',
							closeViewType:'0',  //如果展示的为图纸，图纸的关闭方式
							showContent: [{
								title: "",
								type: 1,
								value: ""
							}]

						};
						moduleJson_Obj.attrs.moduleAttr.push({
							attrName: '鼠标悬停信息',
							attrCode: 'basicInfo',
							attrType: 'BasicInfo',
							attrWhere: 'this'
						});
					}
					//网页、监控、高级监控、视频播放、echart组件、天气，变量1，变量2，写值，按钮，画面跳转，脉冲信号 没有点击弹框功能
					// if (moduleType != 'HTML_IFRAME' && moduleType != 'LIVE_IMAGES' && moduleType !=
					// 	'MONITOR_IMAGES' && moduleType != 'SPBF_IMAGES' &&
					// 	moduleType.indexOf("ECHART") == -1 && moduleType.indexOf("WEATHER") == -1 &&
					// 	moduleType != 'TextLableValue' && moduleType != 'VALUE' &&
					// 	moduleType != 'BUTTON' &&
					// 	moduleType != 'BUTTONVALUE' &&
					// 	moduleType != 'BUTTON_JUMP' &&
					// 	moduleType != 'BUTTON_IMPULSES' &&
					// 	moduleType != 'IMAGES_SWITCH'
					// ) {
					// 	moduleJson_Obj.attrs.clickInfo = {
					// 		clickType: '', //默认为空 空为不启用  1启用
					// 		urlContent: 'http://', //弹框出现时要展示的url
					// 		contentWidth: '800', //弹框的宽
					// 		contentHeight: '600' //弹框的高

					// 	};
					// 	moduleJson_Obj.attrs.moduleAttr.push({
					// 		attrName: '鼠标点击弹框',
					// 		attrCode: 'clickInfo',
					// 		attrType: 'ClickInfo',
					// 		attrWhere: 'this'
					// 	});
					// }




					moduleJsonTemp = JSON.stringify(moduleJson_Obj); // 对象必须转为字符串 不然后续修改属性，改组件所有都会被修改。

				}

			}


			var moduleObject = Konva.Node.create(moduleJsonTemp); //不传id 就返回组件对象。

			if (isCopy == true) { // 如果不是复制的 要把属性面板掉出来


			} else { // 如果不是复制的就要走下面的计算
				var stageScale = this.stage.scale();
				var pointX = modulePoint.x;
				var pointY = modulePoint.y;
				modulePoint.x = pointX / stageScale.x - this.stage.x() / stageScale.x;
				modulePoint.y = pointY / stageScale.y - this.stage.y() / stageScale.y;
			}
			modulePoint.x = Math.round(modulePoint.x) + 0.5;
			modulePoint.y = Math.round(modulePoint.y) + 0.5;

			moduleObject.position(modulePoint);
			if (moduleType == 'DATA_IFRAME'){  //监控面板默认比图纸小120px;
				moduleObject.position({x:10,y:100});
				//console.log(moduleObject.children[0].attrs);
				//console.log(this.stage.width());
				moduleObject.children[0].attrs.width=this.stage.width()-20;
				moduleObject.children[0].attrs.height=this.stage.height()-160;

			}
			this.layer.add(moduleObject);
			this.setGroupImage(moduleObject, true, isCopy, index, size);
			this.addModuleEvent(moduleObject);
			moduleObject.draw();

			if (isCopy != true) { // 左边拖过来的
				var moduleTypes = moduleObject.attrs.moduleType;
				if (moduleTypes == 'BASELINE') {
					currentModule = moduleObject;
					stageOper.addLineEdit(currentModule);
					stageOper.showModuleAttr(moduleObject);
				} else if (moduleTypes == 'FLOWLINE') {
					currentModule = moduleObject;
					stageOper.addFlowLineEdit(currentModule);
					stageOper.showModuleAttr(moduleObject);
				} else {
					stageOper.showModuleAttr(moduleObject);

					stageOper.layer_three.find(".transformer").destroy();
					var tr = new Konva.Transformer({
						name: "transformer",
						id: Math.uuid(),
						padding: 5,
						rotationSnaps: [0, 90, 180, 270],
					});
					tr.nodes([moduleObject]);
					stageOper.layer_three.add(tr); //变形框放在第三层
					stageOper.layer_three.draw();

					//给元素添加变化结束事件
					tr.nodes().forEach(function(node) {
						node.off('transformend');
					});
					tr.nodes()[0].on('transformend', function() {
						console.log('transform end');
						stageOper.stackZfun();
						tr = new Konva.Transformer({
							name: "transformer",
							id: Math.uuid(),
							padding: 5,
							rotationSnaps: [0, 90, 180, 270],
						});
						stageOper.layer_three.add(tr);
						tr.nodes([moduleObject]);
					});

					var container = this.stage.container(); //让画布获得焦点
					container.tabIndex = 1;
					container.focus();

				}
			}



			return moduleObject;
		},
		/**
		 * 如果是图片或svg要重新初始化
		 * isaddModule 左边拖动过来添加的 为true，如果没有该值则是 编辑的时候初始化的
		 * isCopy true表示 复制的时候走的这个方法，复制的时候，不要再这里加入到撤销数组
		 */
		setGroupImage: function(moduleObject, isaddModule, isCopy, index, size) {
			var isbaseModule = true; // 是不是canvas绘画的基础组件  默认是。
			var moduleType = moduleObject.attrs.moduleType;
			//2023年9月20日新增对按钮背景的初始化
			if((moduleType=="BUTTON" || moduleType=="BUTTONVALUE") && moduleObject.attrs.btnImageUrl){
				//console.log(moduleObject.attrs.btnImageUrl)
				var moudleShapeDes = moduleObject.get('.buttonText')[0];
				//描述外面的框
				var descriptionobjRect = moduleObject.get('.buttonRect')[0];
				descriptionobjRect.width(moudleShapeDes.getWidth());
				descriptionobjRect.height(moudleShapeDes.getHeight());
				var imageObj= new Image();
				imageObj.crossOrigin='Anonymous';
				imageObj.src=moduleObject.attrs.btnImageUrl;
				imageObj.onload=function(){
					descriptionobjRect.fillPatternRepeat('no-repeat');
					descriptionobjRect.fillPatternOffset({ x:0,y:0 });
					var w=descriptionobjRect.getWidth()/imageObj.width;
					var h=descriptionobjRect.getHeight()/imageObj.height;
					descriptionobjRect.fillPatternImage(imageObj);
					descriptionobjRect.fillPatternScale({x:w,y:h});
					descriptionobjRect.getLayer().draw();
				}
			}
      if ((moduleType.indexOf("IMAGES") != -1 || moduleType.indexOf("SVG") != -1) && typeof(moduleType) !=
				"undefined") {
				isbaseModule = false;
				var urlImage = moduleObject.attrs.imageURL;
				//删除原有的 image 组件。
				var nodes = moduleObject.find('Image');
				nodes.each(function(node) {
					node.destroy();
				});




				if (urlImage.indexOf(".gif") == -1) {
					Konva.Image.fromURL(urlImage, function(imageNode) {
						imageNode.name("myShape");
						if (moduleType != "LIVE_IMAGES" && moduleType != "MONITOR_IMAGES" &&
							moduleType != "WEATHER_IMAGES" && moduleType != "SPBF_IMAGES") {
							imageNode.setAttr("offset", {
								x: imageNode.width() / 2,
								y: imageNode.height() / 2,
							});
						}
						moduleObject.add(imageNode);
						if (isCopy == true) {
							stageOper.addTransformer();
							//stageOper.stackZfun();
						}

						// 存入到撤销的数组
						if (isaddModule && isCopy != true) {
							stageOper.stackZfun();

							stageOper.layer_three.find(".transformer").destroy();
							var tr = new Konva.Transformer({
								name: "transformer",
								id: Math.uuid(),
								padding: 5,
								rotationSnaps: [0, 90, 180, 270],
							});
							tr.nodes([moduleObject]);
							stageOper.layer_three.add(tr);
							stageOper.layer_three.draw();
						}
						stageOper.layer.draw();

					}, "config/gyyj/noimg.svg");

				} else {

					var canvas = document.createElement('canvas');
					var image;
					var statusIn_add = false;
					gifler(urlImage).frames(canvas, function(ctx, frame) {
						// update canvas size
						canvas.width = frame.width;
						canvas.height = frame.height;
						// update canvas that we are using for Konva.Image
						ctx.drawImage(frame.buffer, 0, 0);
						// redraw the layer
						stageOper.layer.batchDraw();
						if (!statusIn_add) {
							image = new Konva.Image({
								image: canvas,
								offset: {
									x: canvas.width / 2,
									y: canvas.height / 2
								}
							});
							moduleObject.add(image);
							// 存入到撤销的数组
							if (isaddModule && isCopy != true) {
								stageOper.stackZfun();
								stageOper.layer_three.find(".transformer").destroy();
								var tr = new Konva.Transformer({
									name: "transformer",
									id: Math.uuid(),
									padding: 5,
									rotationSnaps: [0, 90, 180, 270],
								});
								tr.nodes([moduleObject]);
								stageOper.layer_three.add(tr);
								stageOper.layer_three.draw();
								stageOper.layer.draw();

							}
							if (isCopy == true) {
								stageOper.addTransformer();
							}

							statusIn_add = true;
						}



					});




				}




			}
			if ((moduleType.indexOf("GIF") != -1) && typeof(moduleType) != "undefined") { // gif动画处理
				isbaseModule = false;
				var urlImage = moduleObject.attrs.imageURL;
				//删除原有的 image 组件。
				var nodes = moduleObject.find('Image');
				nodes.each(function(node) {
					node.destroy();
				});

				var canvas = document.createElement('canvas');
				var statusIn_Madd = false;
				gifler(urlImage).frames(canvas, function(ctx, frame) {
					// update canvas size
					canvas.width = frame.width;
					canvas.height = frame.height;
					// update canvas that we are using for Konva.Image
					ctx.drawImage(frame.buffer, 0, 0);
					// redraw the layer
					stageOper.layer.batchDraw();


					if (!statusIn_Madd) {
						if (isCopy == true) {
							stageOper.addTransformer();
						}
						statusIn_Madd = true;

						if (isaddModule && isCopy != true) {
							stageOper.stackZfun();
							stageOper.layer_three.find(".transformer").destroy();
							var tr = new Konva.Transformer({
								name: "transformer",
								id: Math.uuid(),
								padding: 5,
								rotationSnaps: [0, 90, 180, 270],
							});
							tr.nodes([moduleObject]);
							stageOper.layer_three.add(tr);
							stageOper.layer_three.draw();
							stageOper.layer.draw();
						}


					}
				});
				var image = new Konva.Image({
					image: canvas,
				});

				moduleObject.add(image);

				// 存入到撤销的数组
				/*  if(isaddModule&&isCopy!=true) {
				      stageOper.stackZfun();

				  }*/

			}
			//如果是echart组件
			if (moduleType.indexOf("ECHART") != -1 && typeof(moduleType) != "undefined") {
				isbaseModule = false;
				var urlImage = moduleObject.attrs.echartURL;
				var divWidth = moduleObject.attrs.width;
				var divHeight = moduleObject.attrs.height;
				//删除原有的 image 组件。
				var nodes = moduleObject.find('Image');
				nodes.each(function(node) {
					node.destroy();
				});
				Konva.Image.fromURL(moduleObject.attrs.echartIcon, function(imageNode) {
					moduleObject.add(imageNode);
					stageOper.layer.add(moduleObject);
					stageOper.layer.draw();
					if (isCopy == true) {
						stageOper.addTransformer();
					}
					// 存入到撤销的数组
					if (isaddModule && isCopy != true) {
						stageOper.stackZfun();
						stageOper.layer_three.find(".transformer").destroy();
						var tr = new Konva.Transformer({
							name: "transformer",
							id: Math.uuid(),
							padding: 5,
							rotationSnaps: [0, 90, 180, 270],
						});
						tr.nodes([moduleObject]);
						stageOper.layer_three.add(tr);
						stageOper.layer_three.draw();
						stageOper.layer.draw();

					}
				}, "config/gyyj/noimg.svg");
			}
			if (isbaseModule && isCopy != true) {
				// 存入到撤销的数组
				if (isaddModule && isCopy != true) {
					stageOper.stackZfun();
				}
			}


		},


		/**
		 *给组件添加事件 鼠标放上去手型 ，鼠标点击 可编辑
		 * @param moduleObject 组件对象
		 */
		addModuleEvent: function(moduleObject) {
			moduleObject.on('mouseover', function(e) {
				var shape = e.target;
				//移动到第三层
				/*var mudule_target = e.currentTarget;
                console.log(mudule_target.attrs.name);
                mudule_target.moveTo(stageOper.layer_three);
                stageOper.layer.draw();
                stageOper.layer_three.draw();
 */
				if (shape.name().indexOf("edit_anchor") != -1) {
					document.body.style.cursor = 'crosshair';
				} else {
					if (moduleObject.draggable() == false) {
						document.body.style.cursor = 'not-allowed';
					} else {
						document.body.style.cursor = 'move';
					}

				}


				return;
			});
			moduleObject.on('mouseout', function(e) {
				document.body.style.cursor = 'default';
				//回到第二层
				/*var mudule_target = e.currentTarget;
				mudule_target.moveTo(stageOper.layer);
				stageOper.stage.draw();*/
				return;
			});
			moduleObject.on('click', function() {
				try {
					//显示组件的属性 出现变换框的时候才调出属性面板，所以注释了
					// stageOper.showModuleAttr(moduleObject);
				} catch (error) {} finally {

				}
				return;
			});

			// moduleObject.on('dragend', function (e) {//移动的时候，移动结束回到第二层

			// });
			moduleObject.on('dragstart', function(e) { //移动的时候，提到第三层
				//  stageOper.layer.draw();
				return;
			});
		},
		/**
		 *给组件添加点击选中，鼠标拖拉选中多个的事件
		 * @param moduleObject 组件对象
		 */
		addModuleTransformEvent: function() {
			var tr = null;
			var selectionRectangle = null;

			var x1, y1, x2, y2;
			this.stage.on('mousedown touchstart', function(e) {
				// do nothing if we mousedown on eny shape
				if (e.target !== stageOper.stage && e.target.attrs.name !== "myShapeBackgroundImage") {
					//selectionRectangle.visible(false);
					return;
				}
				$("#zjsx").html(""); //清除属性面板
				x1 = stageOper.stage.getPointerPosition().x;
				y1 = stageOper.stage.getPointerPosition().y;
				x2 = stageOper.stage.getPointerPosition().x;
				y2 = stageOper.stage.getPointerPosition().y;

				var rects = stageOper.layer_three.find('.selectionRectangle'); //删除所有的绘制的区域方
				rects.destroy()

				stageOper.layer_three.draw();

				// 初始化蓝方 在 -500 的位置，放在 组件在右上角的地方，由于 位置是0，0 点击任意地方 会被选中
				selectionRectangle = new Konva.Rect({
					x: -500,
					y: -500,
					name: 'selectionRectangle',
					id: Math.uuid(),
					fill: 'rgba(0,0,255,0.5)',
				});
				stageOper.layer_three.add(selectionRectangle);

				selectionRectangle.visible(true);
				selectionRectangle.width(0);
				selectionRectangle.height(0);
				stageOper.layer_three.draw();
			});


			this.stage.on('mousemove touchmove', function() {
				if (spaceIsDown == true) {
					document.body.style.cursor = 'all-scroll';
				}
				if (stageOper.stage.draggable() == true) {
					return;
				}
				if (selectionRectangle == null) { // 矩形为空或 画布在放大，或缩小状态，不可以框选组件
					return;
				}
				x2 = stageOper.stage.getPointerPosition().x;
				y2 = stageOper.stage.getPointerPosition().y;


				var stageScale = stageOper.stage.scale();
				/*  var pointX= modulePoint.x;
				  var pointY= modulePoint.y;
				  modulePoint.x=pointX/stageScale.x;
				  modulePoint.y=pointY/stageScale.y;*/


				selectionRectangle.setAttrs({
					x: Math.min(x1, x2) / stageScale.x - stageOper.stage.x() / stageScale.x,
					y: Math.min(y1, y2) / stageScale.y - stageOper.stage.y() / stageScale.y,
					width: Math.abs(x2 - x1) / stageScale.x,
					height: Math.abs(y2 - y1) / stageScale.y
				});
				/* selectionRectangle.setAttrs({
				     x: Math.min(x1, x2),
				     y: Math.min(y1, y2),
				     width: Math.abs(x2 - x1),
				     height: Math.abs(y2 - y1),
				     scale:{x:stageOper.layer.scaleX(),y:stageOper.layer.scaleY()}
				 });*/
				//console.log("x:"+stageOper.layer.scaleX()+",y:"+stageOper.layer.scaleY());
				stageOper.layer_three.draw();
			});


			this.stage.on('mouseup touchend', function(e) {
				try {
					var transformerObj = stageOper.layer_three.findOne('.transformer');
					var trMoudle = transformerObj.nodes();
					if (trMoudle.length == 1) {

					} else {
						var shapeObj = e.target;
						var moduleObj_type = shapeObj.parent().attrs.moduleType;

						if (shapeObj.name().indexOf("edit_anchor") == -1 || (moduleObj_type !=
								'FLOWLINE' && moduleObj_type != 'BASELINE')) { // 表示没有选择到锚点
							$("#zjsx").html(""); //清除属性面板
						}


					}

				} catch (e) {

				}
				var shapes = stageOper.stage.find('.jyzt_module_group').toArray();
				var selected_length = 0;
				try {
					var box_ = selectionRectangle.getClientRect();
					var selected_ = shapes.filter(function(shape) {
						//return Konva.Util.haveIntersection(box_, shape.getClientRect()) && shape.attrs.moduleType!="FLOWLINE" && shape.attrs.moduleType!="BASELINE" && shape.attrs.moduleType!="Arrow";
						//让线段和流动条也能框选
						return Konva.Util.haveIntersection(box_, shape.getClientRect());
						//return Konva.Util.haveIntersection(box_, shape.getClientRect());
					});
					selected_length = selected_.length;
				} catch (e) {
					selected_length = 0;
				}




				if (e.target.attrs.name == 'selectionRectangle' || e.target === stageOper.stage ||
					selected_length > 0 || e.target.attrs.name == "myShapeBackgroundImage") {
					var box;
					try {
						box = selectionRectangle.getClientRect();
					} catch (e) {
						console.log("移动组件执行了框选组件导致异常" + e);
						return;
					}
					if (!(isNaN(box.x) && isNaN(box.y) && isNaN(box.width) && isNaN(box.height))) {
						var selected = shapes.filter(function(shape) {
							// return Konva.Util.haveIntersection(box, shape.getClientRect()) && shape.attrs.moduleType!="FLOWLINE"&& shape.attrs.moduleType!="BASELINE" && shape.attrs.moduleType!="Arrow";
							//让线段和流动条也能框选
							return Konva.Util.haveIntersection(box, shape.getClientRect());
							//return Konva.Util.haveIntersection(box, shape.getClientRect());
						});

						//清楚线段的锚点

						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'FLOWLINE') {
							stageOper.removeFlowLineEdit(currentModule);
						}
						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'BASELINE') {
							stageOper.removeLineEdit(currentModule);
						}
						currentModule = undefined;

						/* var GroupObjs = stageOper.layer.find('Group');
						 GroupObjs.each(function(groupObj) {
						     var moduleType = groupObj.attrs.moduleType;
						     if(moduleType=='BASELINE'){
						         stageOper.removeLineEdit(groupObj);
						     }
						     if(moduleType=='FLOWLINE'){
						         stageOper.removeFlowLineEdit(groupObj);
						     }

						 });*/

						if (selected.length > 0) {
							if (selected.length == 1) { // 如果只框选一个，要调出属性面板
								//console.log(selected[0]);
								stageOper.showModuleAttr(selected[0]);
							}



							try {
								tr = stageOper.layer_three.findOne('.transformer');
								tr.destroy();
								tr = null;
								//stageOper.layer_three.draw();
							} catch (e) {

							}


							tr = new Konva.Transformer({
								name: "transformer",
								id: Math.uuid(),
								padding: 5,
								rotationSnaps: [0, 90, 180, 270],
							});
							stageOper.layer_three.add(tr);
							tr.nodes(selected);
							//给元素添加变化结束事件
							tr.nodes().forEach(function(node) {
								node.off('transformend');
							});
							tr.nodes()[0].on('transformend', function() {
								console.log('transform end');
								stageOper.stackZfun();
								tr = new Konva.Transformer({
									name: "transformer",
									id: Math.uuid(),
									padding: 5,
									rotationSnaps: [0, 90, 180, 270],
								});
								stageOper.layer_three.add(tr);
								tr.nodes(selected);
							});

							stageOper.layer_three.draw();
							//stageOper.layer.draw();
							// alert(selected.length);

						} else {
							try {
								tr = stageOper.layer_three.findOne('.transformer');
								tr.destroy();
								tr = null;
								stageOper.layer_three.draw();
								//清楚线段的锚点
								/*var GroupObjs = stageOper.layer.find('Group');
								GroupObjs.each(function(groupObj) {
								    var moduleType = groupObj.attrs.moduleType;
								    if(moduleType=='BASELINE'){
								        stageOper.removeLineEdit(groupObj);
								    }

								});*/


							} catch (e) {

							}
						}
					} else {
						//alert("223");
						tr.nodes([]);
						tr.draw();
					}
					selectionRectangle.destroy();
					setTimeout(function() {
						selectionRectangle = null;
						stageOper.layer_three.draw();
					});

					//tr.draw();
				}
				return;
			});






			this.stage.on('click tap', function(e) {

				if (selectionRectangle != null) {
					return;
				}
				$("#zjsx").html(""); //清除属性面板
				//取消线段编辑
				if (e.target === stageOper.stage || e.target.attrs.name === "myShapeBackgroundImage") {
					try {

						tr.nodes([]);
						tr.destroy();
						tr = null;
					} catch (e) {

					}
					stageOper.layer.draw();
					return;
				}

				var metaPressed = e.evt.shiftKey || e.evt.ctrlKey || e.evt.metaKey;
				var isSelected;
				var trNodes = 0;
				try {
					tr = stageOper.layer_three.findOne('.transformer');
					trNodes = tr.nodes();
					if (trNodes.length == 1) { // 如果变形框只有一个，判断是不是线和箭头
						/* if((tr.nodes().indexOf(e.target.getParent()) == 0)&&trNodes[0].attrs.moduleType==='LINE'||trNodes[0].attrs.moduleType==="Arrow"){
						 }else{// 不是线和箭头，初始化选框*/
						tr.setAttrs({
							ignoreStroke: true,
							enabledAnchors: ['top-left', 'top-center', 'top-right',
								'middle-right', 'middle-left', 'bottom-left',
								'bottom-center', 'bottom-right'
							]
						});
						//}
					}
				} catch (e) {
					tr = new Konva.Transformer({
						name: "transformer",
						id: Math.uuid(),
						padding: 5,
						rotationSnaps: [0, 90, 180, 270],
					});
					tr.nodes([]);
					stageOper.layer_three.add(tr);
				}
				if (trNodes == 0) {
					isSelected = false;
				} else {

					isSelected = tr.nodes().indexOf(e.target.getParent()) >= 0;
				}



				if (!metaPressed && !isSelected) { // 如果没有按键，没有选择，就把当前这个选择上
					//清楚线段的锚点  这里 要注释， 应为右键对锚点操作的时候 会触发这里，导致锚点操作失效
					/* var GroupObjs = stageOper.layer.find('Group');
					 GroupObjs.each(function(groupObj) {
					     var moduleType = groupObj.attrs.moduleType;
					     if(moduleType=='BASELINE'){
					         stageOper.removeLineEdit(groupObj);
					     }

					 });*/

					var moduleObj = e.target.getParent();
					var moduleType = moduleObj.attrs.moduleType;


					if (moduleType == 'BASELINE') { //线
						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'FLOWLINE') {
							stageOper.removeFlowLineEdit(currentModule);
						}
						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'BASELINE') {
							stageOper.removeLineEdit(currentModule);
						}

						//清楚非当前选择的 线段的锚点  （取消非当先线段的编辑）
						/*  var GroupObjs = stageOper.layer.find('Group');
						  GroupObjs.each(function(groupObj) {
						      var moduleType = groupObj.attrs.moduleType;
						      if(moduleType=='BASELINE'){
						          if(moduleObj==groupObj){
						          }else{
						              stageOper.removeLineEdit(groupObj);
						          }
						      }
						      if(moduleType=='FLOWLINE'){
						          stageOper.removeFlowLineEdit(groupObj);

						      }
						  });*/
						tr.nodes([]);
						tr.destroy();
						tr = null;
						stageOper.showModuleAttr(moduleObj); // 调出属性面板
						stageOper.addLineEdit(moduleObj);
						currentModule = moduleObj;
						return;
					} else if (moduleType == 'FLOWLINE') { //线\
						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'FLOWLINE') {
							stageOper.removeFlowLineEdit(currentModule);
						}
						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'BASELINE') {
							stageOper.removeLineEdit(currentModule);
						}
						//清楚非当前选择的 线段的锚点  （取消非当先线段的编辑）
						/* var GroupObjs = stageOper.layer.find('Group');
						 GroupObjs.each(function(groupObj) {
						     var moduleType = groupObj.attrs.moduleType;
						     if(moduleType=='FLOWLINE'){
						         if(moduleObj==groupObj){
						         }else{
						             stageOper.removeFlowLineEdit(groupObj);
						         }
						     }
						     if(moduleType=='BASELINE'){
						         stageOper.removeLineEdit(groupObj);
						     }
						 });*/
						tr.nodes([]);
						tr.destroy();
						tr = null;
						stageOper.showModuleAttr(moduleObj); // 调出属性面板
						stageOper.addFlowLineEdit(moduleObj);
						currentModule = moduleObj;
						return;
					} else {
						//清楚线段的锚点
						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'BASELINE') {
							stageOper.removeLineEdit(currentModule);
						}
						if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
							'FLOWLINE') {
							stageOper.removeFlowLineEdit(currentModule);
						}
						currentModule = undefined;
						/*   var GroupObjs = stageOper.layer.find('Group');
						   GroupObjs.each(function(groupObj) {
						       var moduleType = groupObj.attrs.moduleType;
						       if(moduleType=='BASELINE'){
						           stageOper.removeLineEdit(groupObj);
						       }
						       if(moduleType=='FLOWLINE'){
						           stageOper.removeFlowLineEdit(groupObj);
						       }

						   });*/

						if (e.target.getParent().attrs.name == "transformer") {

						} else {
							tr.nodes([e.target.getParent()]);
							//给元素添加变化结束事件
							tr.nodes()[0].off('transformend');
							tr.nodes()[0].on('transformend', function() {
								console.log('transform end');
								stageOper.stackZfun();
								tr = new Konva.Transformer({
									name: "transformer",
									id: Math.uuid(),
									padding: 5,
									rotationSnaps: [0, 90, 180, 270],
								});
								stageOper.layer_three.add(tr);
								tr.nodes([e.target.getParent()]);
							});

							tr.draw();
						}

					}

				} else if (metaPressed && isSelected) { //如果有，并且有按键就取消选择
					// if we pressed keys and node was selected
					// we need to remove it from selection:
					var nodes = tr.nodes().slice(); // use slice to have new copy of array
					// remove node from array
					var removeNode = nodes.splice(nodes.indexOf(e.target.getParent()), 1);
					tr.nodes(nodes);
					//给元素添加变化结束事件
					tr.nodes().forEach(function(node) {
						node.off('transformend');
					});
					tr.nodes()[0].on('transformend', function() {
						console.log('transform end');
						stageOper.stackZfun();
						tr = new Konva.Transformer({
							name: "transformer",
							id: Math.uuid(),
							padding: 5,
							rotationSnaps: [0, 90, 180, 270],
						});
						stageOper.layer_three.add(tr);
						tr.nodes(nodes);
					});
				} else if (metaPressed && !isSelected) { // 如果没有被选择， 并且有按键就添加到选择里面，

					//清楚线段的锚点
					if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
						'BASELINE') {
						stageOper.removeLineEdit(currentModule);
					}
					if (typeof(currentModule) != 'undefined' && currentModule.attrs.moduleType ==
						'FLOWLINE') {
						stageOper.removeFlowLineEdit(currentModule);
					}
					currentModule = undefined;
					/*   var GroupObjs = stageOper.layer.find('Group');
                    GroupObjs.each(function(groupObj) {
                        var moduleType = groupObj.attrs.moduleType;
                        if(moduleType=='BASELINE'){
                            stageOper.removeLineEdit(groupObj);
                        }
                        if(moduleType=='FLOWLINE'){
                            stageOper.removeFlowLineEdit(groupObj);
                        }



                    });
*/
					/*
					                    if(tr.nodes().length==1){//
					                        if(tr.nodes()[0].attrs.moduleType=='FLOWLINE'||tr.nodes()[0].attrs.moduleType=='Arrow'||tr.nodes()[0].attrs.moduleType=='BASELINE'){
					                            layer.msg('已有组件类型为['+tr.nodes()[0].attrs.moduleType+']不能参与多选', {
					                                offset: 't',
					                                anim: 6,
					                                icon:2
					                            });
					                            if(tr.nodes().length==1){// 如果变形框只有一个，调出属性面板
					                                stageOper.showModuleAttr(tr.nodes()[0]);// 调出属性面板
					                            }
					                            return;
					                        }
					                    }
					*/


					// if(e.target.getParent().attrs.moduleType!='FLOWLINE'&&e.target.getParent().attrs.moduleType!='Arrow'&&e.target.getParent().attrs.moduleType!='BASELINE'){// 当前选择的不是线才可以加进来
					if (true) {
						if (e.target.getParent().attrs.name == "transformer") {

						} else {
							var nodes_s = tr.nodes().concat([e.target.getParent()]);
							tr.nodes(nodes_s);
							//给元素添加变化结束事件
							tr.nodes().forEach(function(node) {
								node.off('transformend');
							});
							tr.nodes()[0].on('transformend', function() {
								console.log('transform end');
								stageOper.stackZfun();
								tr = new Konva.Transformer({
									name: "transformer",
									id: Math.uuid(),
									padding: 5,
									rotationSnaps: [0, 90, 180, 270],
								});
								stageOper.layer_three.add(tr);
								tr.nodes(nodes_s);
							});
						}


					} else {
						/*  layer.msg('组件类型为[ '+e.target.getParent().attrs.moduleType+' ]不能参与多选', {
						      offset: 't',
						      anim: 6,
						      icon:2
						  });*/
					}
				}

				if (tr.nodes().length == 1) { // 如果变形框只有一个，调出属性面板
					setTimeout(function() { //
						stageOper.showModuleAttr(tr.nodes()[0]); // 调出属性面板
						return;
					});
				}
				//tr.moveToTop();
				stageOper.layer_three.draw();
				//stageOper.layer.draw();
				return;
			});


		},
		/**
		 * 添加线段编辑
		 */
		addLineEdit: function(moduleObj) {
			var moduleType = moduleObj.attrs.moduleType;
			var anchorS = moduleObj.find('Circle');

			anchorS.destroy();
			moduleObj.draw();

			if (moduleType == 'BASELINE') { //线
				var edit_anchor = moduleObj.find(".edit_anchor");
				if (edit_anchor.length > 0) {
					return;
				}

				var lineObj = moduleObj.find('.line1')[0]; //线的对象
				var points = lineObj.points();
				var strokeWidth = lineObj.strokeWidth();

				for (var i = 0; i < points.length / 2; i++) {
					var x_index = i * 2;
					var y_index = x_index + 1;
					var point_x = points[x_index];
					var pinnt_y = points[y_index];

					var anchor = new Konva.Circle({
						name: 'edit_anchor',
						x: point_x,
						y: pinnt_y,
						radius: strokeWidth / 2 + 5, //半径
						stroke: '#000000', //边框颜色
						strokeWidth: 2, //边框宽度
						draggable: true,
						indexLable: i,
						strokeScaleEnabled: false
					});
					if (i != 0) { //第二个锚点的时候，在在第一个秒点和第二个锚点之间添加一个锚点 这个锚点为虚拟节点

						//当前锚点的上一个锚点
						var point_up_x = points[x_index - 2];
						var pinnt_up_y = points[y_index - 2];


						var anchor_center = new Konva.Circle({
							name: 'edit_anchor' + (i - 1 + 0.5), // 方便拿到虚拟节点
							x: point_up_x + (point_x - point_up_x) / 2,
							y: pinnt_up_y + (pinnt_y - pinnt_up_y) / 2,
							radius: strokeWidth / 2 + 5, //半径
							stroke: '#c2b5b5', //边框颜色
							strokeWidth: 2, //边框宽度
							draggable: true,
							indexLable: i,
							strokeScaleEnabled: false
						});


						anchor_center.on('dragend', function(e) { //重新改变当前节点线的位置
							var currentAnchor = e.currentTarget;
							var indexLable = currentAnchor.attrs.indexLable;
							// 当前移动节点的位置
							var x = currentAnchor.x();
							var y = currentAnchor.y();
							points.splice(indexLable * 2, 0, x, y); //数组里面添加xy
							lineObj.points(points);
							stageOper.stackZfun();
							stageOper.addLineEdit(moduleObj);
						});
						anchor_center.on('dragmove', function(e) { //虚拟锚点移动到电力组件锚点的附件，自动吸附到电力锚点上
							var targetShape = e.currentTarget;
							var targetShapeAbsolutePoint = targetShape
								.absolutePosition(); //当前线段锚点的绝对位置。
							var targetAnchorArr = stageOper.getAnchorArray(); //拿到目标锚点 所有电力组件的锚点
							// console.log("当前锚点的绝对坐标："+targetShapeAbsolutePoint.x+" , "+targetShapeAbsolutePoint.y);
							for (var i = 0; i < targetAnchorArr.absoluteArrayPoints.length; i++) {
								var pointTemp = targetAnchorArr.absoluteArrayPoints[i]; //电力元件的锚点

								var xoffset = pointTemp.x - targetShapeAbsolutePoint.x;
								var yoffset = pointTemp.y - targetShapeAbsolutePoint.y;
								if (Math.abs(xoffset) <= 5 && Math.abs(yoffset) <= 5) {
									console.log("电力组件锚点吸附坐标" + pointTemp.x + " , " + pointTemp.y);
									targetShape.x(targetShape.x() + xoffset); //设置线段锚点的坐标
									targetShape.y(targetShape.y() + yoffset);
									moduleObj.batchDraw();
								}

							}

						});


						moduleObj.add(anchor_center);


					}


					anchor.on('dragend', function(e) { //重新改变当前节点线的位置
						stageOper.stackZfun();
						stageOper.addLineEdit(moduleObj);
					});

					anchor.on('dragmove', function(e) { //重新改变当前节点线的位置
						var currentAnchor = e.currentTarget;
						// 当前移动节点的位置
						var x = currentAnchor.x();
						var y = currentAnchor.y();
						var indexLable = currentAnchor.attrs.indexLable;

						//上一个  和 下一个 虚拟节点
						var up_anchor_name = 'edit_anchor' + (indexLable - 0.5);
						var next_anchor_name = 'edit_anchor' + (indexLable + 0.5);
						var up_virtual_anchor = moduleObj.find('.' + up_anchor_name)[0]; //上一个虚拟节点
						var next_virtual_anchor = moduleObj.find('.' + next_anchor_name)[0]; //下一个虚拟节点


						//上一个实体节点的位置
						var up_anchor_x = points[indexLable * 2 - 2];
						var up_anchor_y = points[indexLable * 2 - 1];

						//下一个实体节点的位置
						var next_anchor_x = points[indexLable * 2 + 2];
						var next_anchor_y = points[indexLable * 2 + 3];





						//设置当前点的位置
						if (indexLable == 0) { // 如果是线段的第一个节点  那么就用第二个节点来作为判断标准，决定是否与第二个节点的x，y相差 10个像素
							//当前锚点的位置设置到线段上 x
							if (Math.abs(points[2] - x) <=
								10) { //锚点的x位置 与 锚点对于的下一个线段点的x位置，相差绝对值在5以内，那么 当前这个点的x位置与下一个线段点的x相同
								points[indexLable * 2] = points[2];
							} else {
								points[indexLable * 2] = x;
							}

							//当前锚点的位置设置到线段上y
							if (Math.abs(points[3] - y) <=
								10) { //锚点的y位置 与 锚点对于的下一个线段点的y位置，相差绝对值在5以内，那么 当前这个点的x位置与下一个线段点的y相同
								points[indexLable * 2 + 1] = points[3];
							} else {
								points[indexLable * 2 + 1] = y;
							}

						} else {

							//准备做45度吸附，难度较高，暂停
							// 直角对边长度
							// var db = Math.abs(y-points[indexLable*2-1]);
							// 直角临边长度
							// var lb = Math.abs( x-points[indexLable*2 - 2]);

							//角度
							// var jd = Math.atan(db/lb) * 180 / Math.PI;
							// console.log("角度: "+jd);

							//当前锚点的位置设置到线段上 x   垂直
							if (Math.abs(points[indexLable * 2 - 2] - x) <=
								10) { //锚点的x位置 与 锚点对于的上一个线段点的x位置，相差绝对值在5以内，那么 当前这个点的x位置与上一个线段点的x相同
								points[indexLable * 2] = points[indexLable * 2 - 2];
							} else {
								points[indexLable * 2] = x;
							}

							//当前锚点的位置设置到线段上y   水平
							if (Math.abs(points[indexLable * 2 - 1] - y) <=
								10) { //锚点的y位置 与 锚点对于的上一个线段点的y位置，相差绝对值在5以内，那么 当前这个点的x位置与上一个线段点的y相同
								points[indexLable * 2 + 1] = points[indexLable * 2 - 1];
							} else {
								points[indexLable * 2 + 1] = y;
							}

						}



						lineObj.points(points);


						// 设置虚拟节点的 位置，让虚拟节点的位置保持在实体节点的中央
						// 上一个虚拟节点
						if (typeof(up_virtual_anchor) != "undefined") {
							up_virtual_anchor.x(up_anchor_x + (x - up_anchor_x) / 2);
							up_virtual_anchor.y(up_anchor_y + (y - up_anchor_y) / 2);
						}

						// 下一个虚拟节点

						if (typeof(next_virtual_anchor) != "undefined") {
							next_virtual_anchor.x(x + (next_anchor_x - x) / 2);
							next_virtual_anchor.y(y + (next_anchor_y - y) / 2);
						}


						moduleObj.draw();

						//下面设置 当锚点 靠近电力组件锚点5像素范围内吸附到电力组件锚点上
						var currentAnchorAbsolutePoint = currentAnchor
							.absolutePosition(); //当前线段锚点的绝对位置。
						var targetAnchorArr = stageOper.getAnchorArray(); //拿到目标锚点 所有电力组件的锚点
						//  console.log("当前锚点的绝对坐标："+currentAnchorAbsolutePoint.x+" , "+currentAnchorAbsolutePoint.y);
						for (var i = 0; i < targetAnchorArr.absoluteArrayPoints.length; i++) {
							var pointTemp = targetAnchorArr.absoluteArrayPoints[i]; //电力元件的锚点

							var xoffset = pointTemp.x - currentAnchorAbsolutePoint.x;
							var yoffset = pointTemp.y - currentAnchorAbsolutePoint.y;
							if (Math.abs(xoffset) <= 5 && Math.abs(yoffset) <= 5) {
								// console.log("电力组件锚点吸附坐标" + pointTemp.x + " , " + pointTemp.y);
								currentAnchor.x(currentAnchor.x() + xoffset); //设置线段锚点的坐标
								currentAnchor.y(currentAnchor.y() + yoffset);
								//设置线段点的位置
								var lineModule = currentAnchor.getParent();

								// var points = lineObj.points();//线段的全部坐标
								points[indexLable * 2] = currentAnchor.x();
								points[indexLable * 2 + 1] = currentAnchor.y();

								lineObj.points(points);

								moduleObj.draw();
							}
						}

					});


					moduleObj.add(anchor);


				}


				moduleObj.draw();

			}
		},
		/**
		 * 添加流动线条编辑
		 */
		addFlowLineEdit: function(moduleObj) {
			var moduleType = moduleObj.attrs.moduleType;
			var anchorS = moduleObj.find('Circle');

			anchorS.destroy();

			moduleObj.draw();

			if (moduleType == 'FLOWLINE') { //线
				var edit_anchor = moduleObj.find(".edit_anchor");
				if (edit_anchor.length > 0) {
					return;
				}

				var lineObj = moduleObj.find('.backgroundLine')[0]; //背景线
				var lineObj2 = moduleObj.find('.dynamicLine')[0]; //流动线

				var points = lineObj.points();
				var strokeWidth = lineObj.strokeWidth();

				for (var i = 0; i < points.length / 2; i++) {
					var x_index = i * 2;
					var y_index = x_index + 1;
					var point_x = points[x_index];
					var pinnt_y = points[y_index];

					var anchor = new Konva.Circle({
						name: 'edit_anchor',
						x: point_x,
						y: pinnt_y,
						radius: strokeWidth / 2 + 5, //半径
						stroke: '#000000', //边框颜色
						strokeWidth: 2, //边框宽度
						draggable: true,
						indexLable: i,
						strokeScaleEnabled: false
					});
					if (i != 0) { //第二个锚点的时候，在在第一个秒点和第二个锚点之间添加一个锚点 这个锚点为虚拟节点

						//当前锚点的上一个锚点
						var point_up_x = points[x_index - 2];
						var pinnt_up_y = points[y_index - 2];


						var anchor_center = new Konva.Circle({
							name: 'edit_anchor' + (i - 1 + 0.5), // 方便拿到虚拟节点
							x: point_up_x + (point_x - point_up_x) / 2,
							y: pinnt_up_y + (pinnt_y - pinnt_up_y) / 2,
							radius: strokeWidth / 2 + 5, //半径
							stroke: '#c2b5b5', //边框颜色
							strokeWidth: 2, //边框宽度
							draggable: true,
							indexLable: i,
							strokeScaleEnabled: false
						});


						anchor_center.on('dragend', function(e) { //重新改变当前节点线的位置
							var currentAnchor = e.currentTarget;
							var indexLable = currentAnchor.attrs.indexLable;
							// 当前移动节点的位置
							var x = currentAnchor.x();
							var y = currentAnchor.y();
							points.splice(indexLable * 2, 0, x, y); //数组里面添加xy
							lineObj.points(points);
							lineObj2.points(points);
							stageOper.stackZfun();
							stageOper.addFlowLineEdit(moduleObj);
						});


						moduleObj.add(anchor_center);


					}


					anchor.on('dragend', function(e) { //重新改变当前节点线的位置
						stageOper.stackZfun();
						stageOper.addFlowLineEdit(moduleObj);
					});

					anchor.on('dragmove', function(e) { //重新改变当前节点线的位置
						var currentAnchor = e.currentTarget;
						// 当前移动节点的位置
						var x = currentAnchor.x();
						var y = currentAnchor.y();
						var indexLable = currentAnchor.attrs.indexLable;

						//上一个  和 下一个 虚拟节点
						var up_anchor_name = 'edit_anchor' + (indexLable - 0.5);
						var next_anchor_name = 'edit_anchor' + (indexLable + 0.5);
						var up_virtual_anchor = moduleObj.find('.' + up_anchor_name)[0]; //上一个虚拟节点
						var next_virtual_anchor = moduleObj.find('.' + next_anchor_name)[0]; //下一个虚拟节点


						//上一个实体节点的位置
						var up_anchor_x = points[indexLable * 2 - 2];
						var up_anchor_y = points[indexLable * 2 - 1];

						//下一个实体节点的位置
						var next_anchor_x = points[indexLable * 2 + 2];
						var next_anchor_y = points[indexLable * 2 + 3];


						//当前锚点的位置设置到线段上
						if (indexLable == 0) { // 如果是线段的第一个节点  那么就用第二个节点来作为判断标准，决定是否与第二个节点的x，y相差 10个像素
							//当前锚点的位置设置到线段上 x
							if (Math.abs(points[2] - x) <=
								10) { //锚点的x位置 与 锚点对于的下一个线段点的x位置，相差绝对值在5以内，那么 当前这个点的x位置与下一个线段点的x相同
								points[indexLable * 2] = points[2];
							} else {
								points[indexLable * 2] = x;
							}

							//当前锚点的位置设置到线段上y
							if (Math.abs(points[3] - y) <=
								10) { //锚点的y位置 与 锚点对于的下一个线段点的y位置，相差绝对值在5以内，那么 当前这个点的x位置与下一个线段点的y相同
								points[indexLable * 2 + 1] = points[3];
							} else {
								points[indexLable * 2 + 1] = y;
							}

						} else {

							//准备做45度吸附，难度较高，暂停
							// 直角对边长度
							// var db = Math.abs(y-points[indexLable*2-1]);
							// 直角临边长度
							// var lb = Math.abs( x-points[indexLable*2 - 2]);

							//角度
							// var jd = Math.atan(db/lb) * 180 / Math.PI;
							// console.log("角度: "+jd);

							//当前锚点的位置设置到线段上 x   垂直
							if (Math.abs(points[indexLable * 2 - 2] - x) <=
								10) { //锚点的x位置 与 锚点对于的上一个线段点的x位置，相差绝对值在5以内，那么 当前这个点的x位置与上一个线段点的x相同
								points[indexLable * 2] = points[indexLable * 2 - 2];
							} else {
								points[indexLable * 2] = x;
							}

							//当前锚点的位置设置到线段上y   水平
							if (Math.abs(points[indexLable * 2 - 1] - y) <=
								10) { //锚点的y位置 与 锚点对于的上一个线段点的y位置，相差绝对值在5以内，那么 当前这个点的x位置与上一个线段点的y相同
								points[indexLable * 2 + 1] = points[indexLable * 2 - 1];
							} else {
								points[indexLable * 2 + 1] = y;
							}

						}

						lineObj.points(points);
						lineObj2.points(points);


						// 设置虚拟节点的 位置
						// 上一个虚拟节点
						if (typeof(up_virtual_anchor) != "undefined") {
							up_virtual_anchor.x(up_anchor_x + (x - up_anchor_x) / 2);
							up_virtual_anchor.y(up_anchor_y + (y - up_anchor_y) / 2);
						}

						// 下一个虚拟节点

						if (typeof(next_virtual_anchor) != "undefined") {
							next_virtual_anchor.x(x + (next_anchor_x - x) / 2);
							next_virtual_anchor.y(y + (next_anchor_y - y) / 2);
						}


						moduleObj.draw();


					});


					moduleObj.add(anchor);


				}


				moduleObj.draw();

			}
		},
		/**
		 * 取消线段编辑
		 */
		removeLineEdit: function(moduleObj) {
			var moduleType = moduleObj.attrs.moduleType;
			var anchorS = moduleObj.find('Circle');
			if (anchorS.length > 0) {
				anchorS.destroy();
				/* anchorS.each(function(anc) {
				     anc.destroy();
				 });*/
				moduleObj.getLayer().draw();
			}
		},
		/**
		 * 取消流动线段编辑
		 */
		removeFlowLineEdit: function(moduleObj) {
			var moduleType = moduleObj.attrs.moduleType;
			var anchorS = moduleObj.find('Circle');
			if (anchorS.length > 0) {
				anchorS.destroy();
				/* anchorS.each(function(anc) {
				     anc.destroy();
				 });*/
				moduleObj.getLayer().draw();
			}
		},
		/**
		 * 添加元素的右键菜单
		 */
		addModuleContextmenu: function() {

			this.stage.on('contextmenu', function(e) {
				// prevent default behavior
				e.evt.preventDefault();
				if (e.target === stageOper.stage) {
					// if we are on empty place of the stage we will do nothing
					return;
				}
				//当前选中的元素
				currentModule = e.target.getParent();
				currentModule_shape = e.target;
				// show menu

				var containerRect = stageOper.stage.container().getBoundingClientRect();

				var winHeight = $(document).height();
				var topMenu = containerRect.top + stageOper.stage.getPointerPosition().y + 4;
				var heightMenu = $('#menu').outerHeight()
				var leftMenuTempH = topMenu + heightMenu;
				if (leftMenuTempH > winHeight) {
					var offsetHeight = leftMenuTempH - winHeight;
					menuNode.style.top =
						(containerRect.top + stageOper.stage.getPointerPosition().y + 4) -
						offsetHeight - 5 + 'px';
					menuNode.style.left =
						containerRect.left + stageOper.stage.getPointerPosition().x + 4 + 'px';
				} else {
					menuNode.style.top =
						containerRect.top + stageOper.stage.getPointerPosition().y + 4 + 'px';
					menuNode.style.left =
						containerRect.left + stageOper.stage.getPointerPosition().x + 4 + 'px';
				}
				menuNode.style.display = 'initial';



			});

		},
		/**
		 * 改变当前选中组件的层级关系
		 */
		changeModuleZindex: function(fx) {
			if (currentModule.attrs.name != "layer_grid") { //选择到背景，不让处理
				if (fx == 'up') {
					currentModule.moveUp();
				} else if (fx == 'down') {
					currentModule.moveDown();
				} else if (fx == 'top') {
					currentModule.moveToTop();
				} else if (fx == 'bottom') {
					currentModule.moveToBottom();
				}
				var transformerObj = this.layer_three.findOne('.transformer');
				transformerObj.destroy();
				this.layer_three.draw();
				this.layer.draw();
			}
		},
		/**
		 * 删除当前选中的组件
		 */
		deleteModule: function(delMoudle) {
			$("#zjsx").html(""); //清除属性面板
			try {
				var transformerObj = this.layer_three.findOne('.transformer');
				var trMoudle = transformerObj.nodes();
				for (var i = 0; i < trMoudle.length; i++) {
					trMoudle[i].destroy();
				}

				// 自由变换框 要 设置为空
				transformerObj.destroy();

			} catch (e) {

			}
			try {
				if (delMoudle.attrs.name != "layer_grid") { //选择到背景，不让处理
					delMoudle.destroy();
				}


			} catch (e) {

			}


			this.layer_three.draw();
			this.layer.draw();

		},
		/**
		 * 锁定当前选中的组件
		 */
		lockModule: function(currentModule, isLock) {
			try {
				var transformerObj = this.layer_three.findOne('.transformer');
				var trMoudle = transformerObj.nodes();
				for (var i = 0; i < trMoudle.length; i++) {
					if (isLock) {
						trMoudle[i].draggable(false);
					} else {
						trMoudle[i].draggable(true);
					}
				}
				// 自由变换框 要 设置为空
				transformerObj.destroy();

			} catch (e) {

			}
			try {
				if (currentModule.attrs.name != "layer_grid") { //选择到背景，不让处理
					if (isLock) {
						currentModule.draggable(false);
					} else {
						currentModule.draggable(true);
					}


				}


			} catch (e) {

			}


			this.layer_three.draw();
			this.layer.draw();

		},
		/**
		 * 右键对齐功能
		 */
		moduleAlign: function(alignFlag) {
			try {
				var transformerObj = this.layer_three.findOne('.transformer');
				var trMoudle = transformerObj.nodes();
				if (alignFlag == "left_align") { // 左对齐
					var xarr = new Array();
					for (var i = 0; i < trMoudle.length; i++) {
						var mx = trMoudle[i].x();
						var mtype = trMoudle[i].attrs.moduleType;
						var mwidth = 0;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								mwidth = trMoudle[i].getClientRect().width / 2;
							} else {
								mwidth = 0;
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								mwidth = trMoudle[i].getClientRect().width / 2;
							} else {
								mwidth = 0;
							}

						}
						xarr.push((mx - mwidth));
					}
					var x_min = Math.min.apply(null, xarr); //最小值
					for (var i = 0; i < trMoudle.length; i++) {
						var mtype = trMoudle[i].attrs.moduleType;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								trMoudle[i].x((x_min + (trMoudle[i].getClientRect().width / 2)));
							} else {
								trMoudle[i].x(x_min);
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								trMoudle[i].x((x_min + (trMoudle[i].getClientRect().width / 2)));
							} else {
								trMoudle[i].x(x_min);
							}


						}
					}
					// 自由变换框 要 设置为空
					transformerObj.destroy();
				}
				if (alignFlag == "right_align") { // 右对齐
					var xarr = new Array();
					for (var i = 0; i < trMoudle.length; i++) {
						var mx = trMoudle[i].x();
						var mtype = trMoudle[i].attrs.moduleType;
						var mwidth = 0;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								mwidth = trMoudle[i].getClientRect().width / 2;
							} else {
								mwidth = trMoudle[i].getClientRect().width;
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								mwidth = trMoudle[i].getClientRect().width / 2;
							} else {
								mwidth = trMoudle[i].getClientRect().width;
							}

						}
						xarr.push((mx + mwidth));
					}
					var x_max = Math.max.apply(null, xarr); //最大值
					for (var i = 0; i < trMoudle.length; i++) {
						var mtype = trMoudle[i].attrs.moduleType;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								trMoudle[i].x((x_max - (trMoudle[i].getClientRect().width / 2)));
							} else {
								trMoudle[i].x((x_max - trMoudle[i].getClientRect().width));
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								trMoudle[i].x((x_max - trMoudle[i].getClientRect().width / 2));
							} else {
								trMoudle[i].x((x_max - trMoudle[i].getClientRect().width));
							}

						}
					}
					// 自由变换框 要 设置为空
					transformerObj.destroy();
				}
				if (alignFlag == "up_align") { // 上对齐
					var yarr = new Array();
					for (var i = 0; i < trMoudle.length; i++) {
						var my = trMoudle[i].y();
						var mtype = trMoudle[i].attrs.moduleType;
						var mheight = 0;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								mheight = trMoudle[i].getClientRect().height / 2;
							} else {
								mheight = 0;
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								mheight = trMoudle[i].getClientRect().height / 2;
							} else {
								mheight = 0;
							}

						}
						yarr.push((my - mheight));
					}
					var y_min = Math.min.apply(null, yarr); //最小值
					for (var i = 0; i < trMoudle.length; i++) {
						var mtype = trMoudle[i].attrs.moduleType;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								trMoudle[i].y((y_min + (trMoudle[i].getClientRect().height / 2)));
							} else {
								trMoudle[i].y(y_min);
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								trMoudle[i].y((y_min + (trMoudle[i].getClientRect().height / 2)));
							} else {
								trMoudle[i].y(y_min);
							}


						}
					}
					// 自由变换框 要 设置为空
					transformerObj.destroy();
				}
				if (alignFlag == "buttom_align") { // 下对齐
					var yarr = new Array();
					for (var i = 0; i < trMoudle.length; i++) {
						var my = trMoudle[i].y();
						var mtype = trMoudle[i].attrs.moduleType;
						var mheight = 0;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								mheight = trMoudle[i].getClientRect().height / 2;
							} else {
								mheight = trMoudle[i].getClientRect().height;
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								mheight = trMoudle[i].getClientRect().height / 2;
							} else {
								mheight = trMoudle[i].getClientRect().height;
							}

						}
						yarr.push((my + mheight));
					}
					var y_max = Math.max.apply(null, yarr); //最大值
					for (var i = 0; i < trMoudle.length; i++) {
						var mtype = trMoudle[i].attrs.moduleType;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								trMoudle[i].y((y_max - (trMoudle[i].getClientRect().height / 2)));
							} else {
								trMoudle[i].y((y_max - trMoudle[i].getClientRect().height));
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								trMoudle[i].y((y_max - trMoudle[i].getClientRect().height / 2));
							} else {
								trMoudle[i].y((y_max - trMoudle[i].getClientRect().height));
							}

						}
					}
					// 自由变换框 要 设置为空
					transformerObj.destroy();
				}
				if (alignFlag == "center_horizontally") { // 水平居中
					var xarr = new Array();
					for (var i = 0; i < trMoudle.length; i++) {
						var mx = trMoudle[i].x();
						var mtype = trMoudle[i].attrs.moduleType;
						var mwidth = 0;
						var mwidth_l = 0;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								mwidth = trMoudle[i].getClientRect().width / 2;
								mwidth_l = trMoudle[i].getClientRect().width / 2;
							} else {
								mwidth = trMoudle[i].getClientRect().width;
								mwidth_l = 0;
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								mwidth = trMoudle[i].getClientRect().width / 2;
								mwidth_l = trMoudle[i].getClientRect().width / 2;
							} else {
								mwidth = trMoudle[i].getClientRect().width;
								mwidth_l = 0;
							}

						}
						xarr.push((mx + mwidth));
						xarr.push((mx - mwidth_l));
					}
					var x_min = Math.min.apply(null, xarr); //最小值
					var x_max = Math.max.apply(null, xarr); //最大值
					var x_avg = (x_min + x_max) / 2;
					for (var i = 0; i < trMoudle.length; i++) {
						var mtype = trMoudle[i].attrs.moduleType;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								trMoudle[i].x(x_avg);
							} else {
								trMoudle[i].x((x_avg - (trMoudle[i].getClientRect().width / 2)));
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								trMoudle[i].x(x_avg);
							} else {
								trMoudle[i].x((x_avg - (trMoudle[i].getClientRect().width / 2)));
							}

						}
					}
					// 自由变换框 要 设置为空
					transformerObj.destroy();
				}
				if (alignFlag == "vertical_horizontally") { // 垂直居中
					var yarr = new Array();
					for (var i = 0; i < trMoudle.length; i++) {
						var my = trMoudle[i].y();
						var mtype = trMoudle[i].attrs.moduleType;
						var mheight = 0;
						var mheight_l = 0;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								mheight = trMoudle[i].getClientRect().height / 2;
								mheight_l = trMoudle[i].getClientRect().height / 2;
							} else {
								mheight = trMoudle[i].getClientRect().height;
								mheight_l = 0;
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								mheight = trMoudle[i].getClientRect().height / 2;
								mheight_l = trMoudle[i].getClientRect().height / 2;
							} else {
								mheight = trMoudle[i].getClientRect().height;
								mheight_l = 0;
							}

						}
						yarr.push((my + mheight));
						yarr.push((my - mheight_l));
					}
					var y_min = Math.min.apply(null, yarr); //最小值
					var y_max = Math.max.apply(null, yarr); //最大值
					var y_avg = (y_min + y_max) / 2;
					for (var i = 0; i < trMoudle.length; i++) {
						var mtype = trMoudle[i].attrs.moduleType;
						if ((mtype.indexOf("IMAGES") != -1 || mtype.indexOf("SVG") != -1) && typeof(mtype) !=
							"undefined") {
							if (mtype != "LIVE_IMAGES" && mtype != "MONITOR_IMAGES" && mtype !=
								"WEATHER_IMAGES" && mtype != "SPBF_IMAGES") {
								trMoudle[i].y(y_avg);
							} else {
								trMoudle[i].y((y_avg - (trMoudle[i].getClientRect().height / 2)));
							}
						} else {
							if ("Rotating" == mtype || "STATUSLIGHT" == mtype || "STATIC" == mtype) {
								trMoudle[i].y(y_avg);
							} else {
								trMoudle[i].y((y_avg - (trMoudle[i].getClientRect().height / 2)));
							}

						}
					}
					// 自由变换框 要 设置为空
					transformerObj.destroy();
				}


			} catch (e) {

			}
			try {
				if (currentModule.attrs.name != "layer_grid") { //选择到背景，不让处理



				}


			} catch (e) {

			}



			this.layer_three.draw();
			this.layer.draw();

		},
		/**
		 * 删除当前选中线段的锚点
		 */
		deleteModuleAnchor: function() {

			var moduleType = currentModule.attrs.moduleType;
			if (moduleType == 'BASELINE') {
				if (currentModule_shape.name() == ('edit_anchor')) {
					var lineObject = currentModule.find('.line1')[0];
					var points = lineObject.points();
					if (points.length > 4) {
						var indexLable = currentModule_shape.attrs.indexLable;
						points.splice(indexLable * 2, 2); //数组里面添加xy
						lineObject.points(points);
						currentModule_shape.destroy();
						try {
							//上一个虚拟锚点
							var up_anchor_name = 'edit_anchor' + (indexLable - 0.5);
							var up_virtual_anchor = currentModule.find('.' + up_anchor_name)[0]; //上一个虚拟节点
							up_virtual_anchor.destroy();
						} catch (e) {}
						try {
							//下一个虚拟锚点
							var next_anchor_name = 'edit_anchor' + (indexLable + 0.5);
							var next_virtual_anchor = currentModule.find('.' + next_anchor_name)[0]; //下一个虚拟节点
							next_virtual_anchor.destroy();
						} catch (e) {}
						this.addLineEdit(currentModule);

					} else {
						layer.msg('锚点不可删除', {
							offset: 't',
							anim: 6,
							icon: 2
						});
					}

				}
			}
			if (moduleType == 'FLOWLINE') {
				if (currentModule_shape.name() == ('edit_anchor')) {
					var lineObject = currentModule.find('.backgroundLine')[0];
					var lineObject2 = currentModule.find('.dynamicLine')[0];
					var points = lineObject.points();
					if (points.length > 4) {
						var indexLable = currentModule_shape.attrs.indexLable;
						points.splice(indexLable * 2, 2); //数组里面添加xy
						lineObject.points(points);
						lineObject2.points(points);
						currentModule_shape.destroy();
						try {
							//上一个虚拟锚点
							var up_anchor_name = 'edit_anchor' + (indexLable - 0.5);
							var up_virtual_anchor = currentModule.find('.' + up_anchor_name)[0]; //上一个虚拟节点
							up_virtual_anchor.destroy();
						} catch (e) {}
						try {
							//下一个虚拟锚点
							var next_anchor_name = 'edit_anchor' + (indexLable + 0.5);
							var next_virtual_anchor = currentModule.find('.' + next_anchor_name)[0]; //下一个虚拟节点
							next_virtual_anchor.destroy();
						} catch (e) {}
						this.addFlowLineEdit(currentModule);

					} else {
						layer.msg('锚点不可删除', {
							offset: 't',
							anim: 6,
							icon: 2
						});
					}

				}
			}






			this.layer.draw();


		},
		/**
		 * 左键点击时显示组件的属性
		 */
		showModuleAttr: function(moduleObject) {
			$("#zjsx").html("");
			var moduleAttrHtml = "";
			var moduleAttrs = moduleObject.attrs.moduleAttr;
			//获取监控面板组件的监控模块
			//console.log(moduleObject.attrs);
			viewDataType =  moduleObject.attrs.tabTypes;
			//console.log(viewDataType);
			//下面这句只用于判断是否为天气组件，以显示提示
			var moduleType = moduleObject.attrs.moduleType;
			//获取数据来源属性
			var dataSourceType = moduleObject.attrs.dataSourceType || "liveData";
			//判断内嵌组件的显示类型
			var insertIframeType = moduleObject.attrs.insertType || "web";

			//设置attrType为color时，placeholder的文字提示
			var tipPlace = "请选择颜色";
			if (moduleType == 'WEATHER_IMAGES') {
				moduleAttrHtml +=
					"<div>说明：</br><p style='color:red;'>1.天气组件在微信小程序中不被支持,将引起组态页面无法在小程序中打开,请慎用；</p><p>2.自动定位所在城市，无需手动设置。</p></div>";
			}
			//天气组件提示结束
			if (typeof(moduleAttrs) == "undefined") {
				return;
			}
			//监控面板默认参数获取
			var defaultArgments=moduleObject.attrs.defaultArgments || "";
			//json字符串不能作为地址参数，这里使用本地存储更方便
			sessionStorage.setItem("defaultArgments",defaultArgments);

			var color_array = new Array();
			var buttonBackgroundColor_array = new Array(); // 按钮背景
			var input_text_array = new Array();
			var textarea_text_array = new Array(); //文本域
			var inputPwd_text_array = new Array();

			var slider_array = new Array();
			var speedSlider_array = new Array();

			var font_array = new Array();
			var font_array_new = new Array(); // 字体 将字体，颜色字号，结合在一起显示
			var dateFormat_array = new Array();
			var fontStyle_array = new Array(); //文字样式


			var fontSize_array = new Array();
			var hardware_array = new Array(); // 废弃
			var hardware_input_array = new Array();
			var jump_input_array = new Array(); //画面跳转
			var where_array = new Array();
			var whereStatus_array = new Array();
			var whereStatusLight_array = new Array();
			var whereStatusSwitch_array = new Array();
			var imagesStatusTable_array = new Array(); //状态图片
			var valueZoomConfig_array = new Array(); //值缩放
			var align_array = new Array(); //文本对齐
			var border_array = new Array(); //变量所有内容设置
			var position_array = new Array(); //组件位置



			var click_array = new Array();
			var clickMcxh_array = new Array(); //脉冲信号配置

			var rotate_array = new Array();
			var rotate_array_new = new Array(); //新的旋转方式 包含顺时针旋转，逆时针旋转。
			var hide_array = new Array();

			var sparkling_array = new Array();

			var readWriteControl_array = new Array();
			var changeTypeControl_array = new Array();
			var resetTypeControl_array = new Array();
			var tabTypesControl_array = new Array();
            var showStyleControl_array = new Array();
			var mapUseControl_array = new Array();
			var equipMapControl_array = new Array();
			var mapStyleControl_array = new Array();
			var dateRangeControl_array = new Array();
			var secondControl_array = new Array();
			var sortTypeControl_array = new Array();
			var showTypeXControl_array = new Array();
			//数据源类型数组
			var dataSourceControl_array = new Array();
			//接口分类控制数组
			var dataApiControl_array = new Array();
			//统计范围控制数组
			var totalAreaControl_array = new Array();
			//接口数组
			var dataApiArray = new Array();
			//设备控制数组，暂时只有设备信息能用到
			var equipIdControl_array = new Array();
			//所有设备数组，暂时只有设备信息能用到
			var equipsArray = new Array();
			//数据分析的时间段控制数组
			var dateTypeControl_array = new Array();
			//数据分析的方法控制数组
			var functionControl_array = new Array();
			//单点信息字段控制数组
			var dataFieldControl_array = new Array();
			//未删减的全部字段数组
			var fieldsArrayAll = new Array();
			//实际使用的字段数组
			var fieldsArray = new Array();
			//监控面板每页条数控制
			var pageSizeControl_array = new Array();
			//监控面板历史数据显示方式
			var showTypeControl_array = new Array();
			//数据源刷新控制数组
			var refreshTypeControl_array = new Array();
			//高级监控界面模板控制数组
			var videoModeControl_array = new Array();
			//内嵌面板类型
			var insertTypeControl_array = new Array();
			//内嵌图纸选择
			var insertViewControl_array = new Array();
			//内嵌图纸所有图纸数组
			var insertViewArray = new Array();
			//文本变量宽度控制选择
			var labelValueWidthControl_array = new Array();
			//文本变量整体对齐控制
			var alignTypeControl_array = new Array();


			var basicInfo_array = new Array(); // 基础信息
			var ClickInfo_array = new Array(); // 鼠标点击弹框

			var on_off_array = new Array(); //初始开合
			var ON_OFFSTATET_array = new Array(); //开合状态

			var dataKeyArrayTable_array = new Array(); //设置多个变量，如新的实时折线图，需要绑定多个变量
			var rotatImage_array = new Array(); //旋转图片选择
      //按钮背景图片选择
      var buttonImage_array = new Array();


			for (var i = 0; i < moduleAttrs.length; i++) {
				var attrName = moduleAttrs[i].attrName;
				var attrCode = moduleAttrs[i].attrCode;
				var attrType = moduleAttrs[i].attrType;
				var attrWhere = moduleAttrs[i].attrWhere;


				var moudleShape;
				var attrValue;
				if (attrWhere.split(",")[0] === 'this') {
					moudleShape = moduleObject;
					attrValue = moudleShape.getAttr(attrCode);
				} else {
					moudleShape = moduleObject.findOne('.' + attrWhere.split(",")[0]);
					attrValue = moudleShape.getAttr(attrCode);
				}
				// console.log("点击组件时要显示的属性: 属性名:"+attrName +"       属性代码"+attrCode+"      属性值:" + attrValue+"       属性类型"+attrType +'       属性所属形状'+attrWhere);
				if (typeof(attrValue) == "undefined") {
					attrValue = '';
				}
				//基础信息展示---------------------------------------------
				if (attrType == 'BasicInfo') {
					var showType = attrValue.showType || ""; //展现方式
					var closeViewType = attrValue.closeViewType || '0'; //图纸关闭方式
					var showContent = attrValue.showContent.length?attrValue.showContent:[{
								title: "",
								type: 1,
								value: ""
							}]; //内容

					moduleAttrHtml +=
						'<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;margin-bottom: 5px;border-color:#000000">' +
						' <legend style="font-size: 16px">' + attrName + '</legend>' +
						' </fieldset>';

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">展现方式</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_zxfs" lay-filter="select_zxfs">';
					if (showType == "") {
						moduleAttrHtml +='<option selected value="">不展示</option>'
						moduleAttrHtml += '<option  value="1">鼠标悬停展示</option>';
					} else if(showType == 1) {
						moduleAttrHtml +='<option  value="">不展示</option>'
						moduleAttrHtml += '<option selected value="1">鼠标悬停展示</option>';
					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';

					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					if(showContent[0].type!='5'){
						moduleAttrHtml +='<div class="layui-form-item"  id="closeViewType" style="display:none;">';
					}else{
						moduleAttrHtml +='<div class="layui-form-item"  id="closeViewType">'
					}
					moduleAttrHtml +=
						'<label class="layui-form-label">关闭方式</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_closeType" lay-filter="select_closeType">';
					if(closeViewType == '0'){
					    moduleAttrHtml += '<option selected value="0">手动关闭</option>';
						moduleAttrHtml += '<option  value="1">鼠标移除关闭</option>';
						moduleAttrHtml += '<option  value="10">延时10秒关闭</option>';
						moduleAttrHtml += '<option  value="30">延时30秒关闭</option>';
						moduleAttrHtml += '<option value="60">延时1分钟关闭</option>';
					}else if (closeViewType == '1') {
						moduleAttrHtml += '<option  value="0">手动关闭</option>';
						moduleAttrHtml += '<option selected value="1">鼠标移除关闭</option>';
						moduleAttrHtml += '<option  value="10">延时10秒关闭</option>';
						moduleAttrHtml += '<option  value="30">延时30秒关闭</option>';
						moduleAttrHtml += '<option value="60">延时1分钟关闭</option>';
					} else if(closeViewType == '10') {
						moduleAttrHtml += '<option  value="0">手动关闭</option>';
						moduleAttrHtml += '<option  value="1">鼠标移除关闭</option>';
						moduleAttrHtml += '<option selected value="10">延时10秒关闭</option>';
						moduleAttrHtml += '<option value="30">延时30秒关闭</option>';
						moduleAttrHtml += '<option  value="60">延时1分钟关闭</option>';
					}else if(closeViewType == '30'){
						moduleAttrHtml += '<option  value="0">手动关闭</option>';
						moduleAttrHtml += '<option  value="1">鼠标移除关闭</option>';
						moduleAttrHtml += '<option  value="10">延时10秒关闭</option>';
						moduleAttrHtml += '<option selected value="30">延时30秒关闭</option>';
						moduleAttrHtml += '<option  value="60">延时1分钟关闭</option>';
					}else if(closeViewType == '60'){
						moduleAttrHtml += '<option  value="0">手动关闭</option>';
						moduleAttrHtml += '<option  value="1">鼠标移除关闭</option>';
						moduleAttrHtml += '<option  value="10">延时10秒关闭</option>';
						moduleAttrHtml += '<option value="30">延时30秒关闭</option>';
						moduleAttrHtml += '<option selected  value="60">延时1分钟关闭</option>';
					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';


					basicInfo_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});

				}


				//鼠标点击弹框---------------------------------------------
				if (attrType == 'ClickInfo') {
					var clickType = attrValue.clickType; //默认为空 空为不启用  1启用
					var urlContent = attrValue.urlContent; //弹框出现时要展示的url
					var contentWidth = attrValue.contentWidth; //弹框的宽
					var contentHeight = attrValue.contentHeight; //弹框的高
					moduleAttrHtml +=
						'<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;margin-bottom: 5px;border-color:#000000">' +
						' <legend style="font-size: 16px">' + attrName + '</legend>' +
						' </fieldset>';

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">是否启用</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_clickSfqy" lay-filter="select_clickSfqy">';
					moduleAttrHtml += '<option  value="">不启用</option>';
					if (clickType == 1) {
						moduleAttrHtml += '<option selected value="1">启用</option>';
					} else {
						moduleAttrHtml += '<option  value="1">启用</option>';
					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';



					//弹框URL-------------------
					moduleAttrHtml += '<div class="layui-form-item">';
					moduleAttrHtml += '<label class="layui-form-label">弹框URL</label>';
					moduleAttrHtml += '<div class="layui-input-block">' +
						'<input id="module_' + attrWhere.split(",")[0] +
						'_URL" type="text" lay-verify=""  value="' + urlContent +
						'" autocomplete="off"  class="layui-input">' +
						'</div>';
					moduleAttrHtml += '</div>'; //最外面的一层


					//宽高-------------------
					moduleAttrHtml += '<div class="layui-form-item">';
					moduleAttrHtml += '<label class="layui-form-label">弹框尺寸</label>';
					//弹框宽
					moduleAttrHtml +=
						'<div class="layui-input-block butTips_attr" data-title="宽" style="margin-left: 5px;float: left">' +
						'<input id="module_' + attrWhere.split(",")[0] +
						'_width" type="text" lay-verify="" style="width: 85px;" value="' + contentWidth +
						'" autocomplete="off"  class="layui-input">' +
						'</div>';
					//弹框高
					moduleAttrHtml +=
						'<div class="layui-input-block butTips_attr" data-title="高" style="margin-left: 5px;float: left">' +
						'<input id="module_' + attrWhere.split(",")[0] +
						'_height" type="text" lay-verify="" style="width: 85px;" value="' + contentHeight +
						'" autocomplete="off"  class="layui-input">' +
						'</div>';
					moduleAttrHtml += '</div>'; //最外面的一层



					ClickInfo_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});

				}

				//组件位置 ---------------------------------------------
				// if (attrType == 'modulePosition') {
				// 	var strokeWidth = moudleShape.getAttr("x");
				// 	var moudlex = moudleShape.getAttr("x"); //X
				// 	var moudley = moudleShape.getAttr("y"); //Y
				// 	var moudleyScaleX = moudleShape.scaleX(); //scaleX
				// 	var moudleyScaleY = moudleShape.scaleY(); //scaleY



				// 	moduleAttrHtml +=
				// 		'<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;margin-bottom: 5px;border-color:#000000">' +
				// 		' <legend style="font-size: 16px">' + attrName + '</legend>' +
				// 		' </fieldset>';

				// 	//位置-------------------
				// 	moduleAttrHtml += '<div class="layui-form-item">';
				// 	moduleAttrHtml += '<label class="layui-form-label">位置</label>';
				// 	//文本框X
				// 	moduleAttrHtml +=
				// 		'<div class="layui-input-block butTips_attr" data-title="X" style="margin-left: 0px;float: left">' +
				// 		'<input id="module_' + attrWhere.split(",")[0] +
				// 		'_x" type="text" lay-verify="" style="width: 85px;" value="' + moudlex +
				// 		'" autocomplete="off"  class="layui-input">' +
				// 		'</div>';
				// 	//文本框Y
				// 	moduleAttrHtml +=
				// 		'<div class="layui-input-block butTips_attr" data-title="Y" style="margin-left: 5px;float: left">' +
				// 		'<input id="module_' + attrWhere.split(",")[0] +
				// 		'_y" type="text" lay-verify="" style="width: 85px;" value="' + moudley +
				// 		'" autocomplete="off"  class="layui-input">' +
				// 		'</div>';
				// 	moduleAttrHtml += '</div>'; //最外面的一层

				// 	//大小--------------
				// 	moduleAttrHtml += '<div class="layui-form-item">';
				// 	moduleAttrHtml += '<label class="layui-form-label">大小</label>';
				// 	//文本框X
				// 	moduleAttrHtml +=
				// 		'<div class="layui-input-block butTips_attr" data-title="大小X" style="margin-left: 0px;float: left">' +
				// 		'<input id="module_' + attrWhere.split(",")[0] +
				// 		'_scalex" type="text" lay-verify="" style="width: 85px;" value="' + moudleyScaleX +
				// 		'" autocomplete="off"  class="layui-input">' +
				// 		'</div>';
				// 	//文本框Y
				// 	moduleAttrHtml +=
				// 		'<div class="layui-input-block butTips_attr" data-title="大小Y" style="margin-left: 5px;float: left">' +
				// 		'<input id="module_' + attrWhere.split(",")[0] +
				// 		'_scaley" type="text" lay-verify="" style="width: 85px;" value="' + moudleyScaleY +
				// 		'" autocomplete="off"  class="layui-input">' +
				// 		'</div>';
				// 	moduleAttrHtml += '</div>'; //最外面的一层



				// 	position_array.push({
				// 		attrCode: attrCode,
				// 		attrValue: attrValue,
				// 		attrWhere: attrWhere
				// 	});

				// }


				if (attrType == 'color') { //颜色面板
				//监控面板中含有表格的组件数组；
				var tableArr = ['historyData','historyTable','alarm','analysis','log','device','statement'];
				var codeArr = ["searchColor","boxBackground","headBackground","fieldColor","tableBorderColor","tableTextColor"];
				if(moduleType == "DATA_IFRAME" && codeArr.indexOf(attrCode)>=0){
					tipPlace = "默认随风格";
				}else{
					tipPlace = "请选择颜色";
				}
				if(moduleType == "DATA_IFRAME"){
					if (attrCode == "borderColor" || attrCode == "boxBackground" || attrCode == "searchColor") {
						moduleAttrHtml += '<div class="layui-form-item" id="' + attrCode + 'Item">';
					}else if(tableArr.indexOf(viewDataType) >= 0 && attrCode != "sensorBoxColor"){
						moduleAttrHtml += '<div class="layui-form-item" id="' + attrCode + 'Item">';
					}else if(tableArr.indexOf(viewDataType) < 0 && viewDataType == "data" && attrCode == "sensorBoxColor"){
						moduleAttrHtml += '<div class="layui-form-item" id="' + attrCode + 'Item">';
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="' + attrCode +
							'Item" style="display:none;">';
					}
				}else{
					moduleAttrHtml += '<div class="layui-form-item" id="' + attrCode + 'Item">';
				}


					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-inline" style="margin-left: 5px;width: 120px;">' +
						'<input type="text" value="' + attrValue +
						'" placeholder="'+tipPlace+'" class="layui-input" id="' + attrCode + '_' + attrWhere.split(
							",")[0] + '_input_color"/>' +
						'</div>' +
						'<div class="layui-inline" style="margin-bottom: 0px; margin-right: 0px;left: -11px;">' +
						'<div id="' + attrCode + '_' + attrWhere.split(",")[0] + '_ico_color"></div>' +
						'</div>' +
						'</div>';
					color_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'align') { //文字对齐
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<div class ="layui-btn-group">';
					if (attrValue == 'left') {
						moduleAttrHtml += '<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="left" class="layui-btn  layui-btn-sm"><i class="layui-icon">&#xe649;</i></button>' +
							'<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="center" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe647;</i></button>' +
							'<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="right" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe648;</i></button>';
					}
					if (attrValue == 'center') {
						moduleAttrHtml += '<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="left" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe649;</i></button>' +
							'<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="center" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe647;</i></button>' +
							'<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="right" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe648;</i></button>';
					}
					if (attrValue == 'right') {
						moduleAttrHtml += '<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="left" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe649;</i></button>' +
							'<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="center" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe647;</i></button>' +
							'<button name="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_align" style="height: 36px;" type="button" alignTtype="right" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe648;</i></button>';
					}


					moduleAttrHtml += '</div>' +
						'</div>' +
						'</div>';

					align_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}


				if (attrType == 'buttonBackgroundColor') { //按钮背景颜色面板
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-inline" style="margin-left: 5px;width: 120px;">' +
						'<input type="text" value="' + attrValue[1] +
						'" placeholder="请选择颜色" class="layui-input" id="' + attrCode + '_' + attrWhere.split(
							",")[0] + '_input_color">' +
						'</div>' +
						'<div class="layui-inline" style="margin-bottom: 0px; margin-right: 0px;left: -11px;">' +
						'<div id="' + attrCode + '_' + attrWhere.split(",")[0] + '_ico_color"></div>' +
						'</div>' +
						'</div>';
					buttonBackgroundColor_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'input') { //输入框

					// moduleAttrHtml +=
					// 	'<div class="layui-form-item">' +
					// 	'<label class="layui-form-label">' + attrName + '</label>' +
					// 	'<div class="layui-input-block">' +
					// 	'<input id="' + attrCode + '_' + attrWhere.split(",")[0] +
					// 	'_input_text" type="text" lay-verify="borderSize" value="' + attrValue +
					// 	'" autocomplete="off"  class="layui-input">' +
					// 	'</div>' +
					// 	'</div>';
					// input_text_array.push({
					// 	attrCode: attrCode,
					// 	attrValue: attrValue,
					// 	attrWhere: attrWhere
					// });
					//只有复位组件用到timeValue，所以非放前面
					if (attrCode != 'timeValue' && attrCode != 'defaultArgments' && attrCode !="labelWidth" && attrCode !="valueWidth") {
						if(moduleType=="HTML_IFRAME" && attrCode=="iframeSrc" && insertIframeType=="web"){
							moduleAttrHtml +='<div class="layui-form-item" id="insertIframe">';
						}else if(moduleType=="HTML_IFRAME" && attrCode=="iframeSrc" && insertIframeType!="web"){
							moduleAttrHtml +='<div class="layui-form-item" id="insertIframe" style="display:none">';
						}else{
							moduleAttrHtml +='<div class="layui-form-item">';
						}
						moduleAttrHtml +=
							//'<div class="layui-form-item">' +
							'<label class="layui-form-label">' + attrName + '</label>' +
							'<div class="layui-input-block">' +
							'<input id="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_input_text" type="text" lay-verify="borderSize" value="' + attrValue +
							'" autocomplete="off"  class="layui-input">' +
							'</div>' +
							'</div>';

					}else if(attrCode == 'timeValue'){
						moduleAttrHtml +=
							'<div class="layui-form-item">' +
							'<label class="layui-form-label">' + attrName + '</label>' +
							'<div class="layui-input-block">' +
							'<input id="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_input_text" type="text" lay-verify="borderSize" value="' + attrValue +
							'" autocomplete="off"  class="layui-input" style="display:inline-block;width:60px!important;"> 秒<span style="color:#ff0000;">(1-120秒)</span>' +
							'</div>' +
							'</div>';
					}else if(attrCode == 'defaultArgments'){
					      // <input  type="text" placeholder="点击设置"  style="cursor:pointer"  readOnly="readOnly"  value="" name="dataViewDefaultSet_set" autocomplete="off"  class="layui-input"  />
					    moduleAttrHtml +=
					    	'<div class="layui-form-item">' +
					    	'<label class="layui-form-label">' + attrName + '</label>' +
					    	'<div class="layui-input-block">' +
					    	'<input id="' + attrCode + '_' + attrWhere.split(",")[0] +
					    	'_input_text" type="button" name="setDefault" lay-verify="borderSize" class="layui-input" value="可忽略,点击可设置或查看" style="display:inline-block;width:202px!important;text-align:left;color:#666;cursor:pointer;"/>' +
					    	'</div>' +
					    	'</div>';
				    }else if(attrCode == 'labelWidth'){
						var val=attrValue?attrValue:56;
						var widthType=moduleObject.attrs.labelValueWidth || 'auto';
						if(widthType=='auto'){
							moduleAttrHtml +=
								'<div class="layui-form-item" id="labelWidthSet" style="display:none">';
						}else{
							moduleAttrHtml +=
								'<div class="layui-form-item" id="labelWidthSet">';
						}
						moduleAttrHtml +=
							// '<div class="layui-form-item" id="labelWidthSet">' +
							'<label class="layui-form-label">' + attrName + '</label>' +
							'<div class="layui-input-block">' +
							'<input id="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_input_text" type="text" lay-verify="borderSize" value="' + val +
							'" autocomplete="off"  class="layui-input">' +
							'</div>' +
							'</div>';
					}else if(attrCode == 'valueWidth'){
						var val=attrValue?attrValue:44;
						var widthType=moduleObject.attrs.labelValueWidth || 'auto';
						if(widthType=='auto'){
							moduleAttrHtml +=
								'<div class="layui-form-item" id="valueWidthSet" style="display:none">';
						}else{
							moduleAttrHtml +=
								'<div class="layui-form-item" id="valueWidthSet">';
						}
						moduleAttrHtml +=
							// '<div class="layui-form-item" id="valueWidthSet">' +
							'<label class="layui-form-label">' + attrName + '</label>' +
							'<div class="layui-input-block">' +
							'<input id="' + attrCode + '_' + attrWhere.split(",")[0] +
							'_input_text" type="text" lay-verify="borderSize" value="' + val +
							'" autocomplete="off"  class="layui-input">' +
							'</div>' +
							'</div>';
					}


					//判断是直播组件时，显示提示信息，显示在最后一个输入框后面；
					//直播地址或验证码后面；
					if (attrCode == 'liveSrc' && moduleType != "SPBF_IMAGES") {
						moduleAttrHtml +=
							'<div>说明：</br>1.目前支持的监控摄像头品牌：萤石，海康(部分型号)；</br>2.地址请使用HLS格式的流畅型地址。</div>'
					}
					// else if(attrCode == 'checkCode' ){
					// 	moduleAttrHtml +=
					// 		'<div>说明：</br>1.目前支持的监控摄像头品牌：萤石，海康(部分型号)；</br>2.高级监控目前不支持在微信小程序中显示，请慎用。相比实时监控高级监控有着更友好的播放界面和最低的延时。</div>'
					// }

					input_text_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'RotatImage') { //旋转组件图片选择
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block"  >' +
						'<img id="' + attrCode + '_' + attrWhere.split(",")[0] +
						'_image" class="butTips_attr" data-title="请选择图片" src="' + attrValue +
						'" style="border-width: 2px;border-style: solid;border-color: green;width: 38px;height: 38px;cursor:pointer"/>' +
						'</div>' +
						'</div>';
					rotatImage_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

        //按钮背景图片选择
        if (attrType == 'buttonImage') { //旋转组件图片选择
            var imgUrl=attrValue?attrValue:'config/gyyj/noimg.svg';
        	moduleAttrHtml +=
        		'<div class="layui-form-item">' +
        		'<label class="layui-form-label">' + attrName + '</label>' +
        		'<div class="layui-input-block"  >' +
        		'<img id="' + attrCode + '_' + attrWhere.split(",")[0] +
        		'_image" class="butTips_attr" data-title="请选择图片" src="' + imgUrl +
        		'" style="border-width: 2px;padding:0;border-style: solid;border-color: green;width:50px;height:25px;cursor:pointer"/>' +
        		//'<button id="deleteBtnImg"  style="width:30px;padding:0;height: 30px;line-height:30px;margin-left:10px;" onclick="'+stageOper.deleteButtonImage(moduleObject)+' class="layui-btn layui-btn-normal"><i class="fa fa-trash-o fa-sm"></i></button>+
        		'</div>' +
        		'</div>';


        	//$("#deleteBtnImg").bind("click",deleteButtonImage(moduleObject));

        	buttonImage_array.push({
        		attrCode: attrCode,
        		attrValue: attrValue,
        		attrWhere: attrWhere
        	});


        }
				if (attrType == 'textarea') { //输入框
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<textarea id="' + attrCode + '_' + attrWhere.split(",")[0] +
						'_textarea_text"  autocomplete="off"  class="layui-textarea">' + attrValue +
						'</textarea>' +
						'</div>' +
						'</div>';
					textarea_text_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}


				if (attrType == 'password') { //密码框
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<input id="' + attrCode + '_' + attrWhere +
						'_inputPwd_text" type="password" lay-verify="borderSize" value="' + attrValue +
						'" autocomplete="off"  class="layui-input">' +
						'</div>' +
						'</div>';
					inputPwd_text_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'slider') { //滑块 透明度
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div id="' + attrCode + '_slider"  class="layui-input-block"></div>' +
						'</div>';
					slider_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'speedSlider') { //旋转速度
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div id="' + attrCode + '_speedSlider"  class="layui-input-block"></div>' +
						'</div>';
					speedSlider_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'BORDER') {
					moduleAttrHtml += '<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>';

					//边框颜色

					moduleAttrHtml +=
						'<div class="layui-inline butTips_attr" data-title="边框颜色"  style="float: left;margin-bottom: 0px; margin-right: 0px;">' +
						'<div style="margin-bottom: 0px;margin-right: 0px;" id="border_' + attrWhere.split(",")[
							0] + '_ico_color"></div>' +
						'</div>';

					//边框粗细
					var strokeWidth = moudleShape.getAttr("strokeWidth");
					moduleAttrHtml +=
						'<div class="layui-input-block butTips_attr" data-title="边框粗细" style="margin-left: 0px;float: left">' +
						'<input id="border_' + attrWhere.split(",")[0] +
						'_size" type="text" lay-verify="borderSize" style="width: 50px;" value="' +
						strokeWidth + '" autocomplete="off"  class="layui-input">' +
						'</div>';
					//边框圆角
					var strokeWidth = moudleShape.getAttr("cornerRadius");
					moduleAttrHtml +=
						'<div class="layui-input-block butTips_attr" data-title="边框圆角" style="margin-left: 5px;float: left">' +
						'<input id="border_' + attrWhere.split(",")[0] +
						'_cornerRadius" type="text" lay-verify="borderSize" style="width: 50px;" value="' +
						strokeWidth + '" autocomplete="off"  class="layui-input">' +
						'</div>';






					moduleAttrHtml += '</div>'; //最外面的一层
					border_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});
				}



				if (attrType == 'ON_OFF') { // 初始开合

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_onOff" lay-filter="select_onOff">';

					if ('0' == attrValue) {
						moduleAttrHtml += '<option selected  value="0">开</option>';
						moduleAttrHtml += '<option  value="1">合</option>';
					} else if ('1' == attrValue) {
						moduleAttrHtml += '<option value="0">开</option>';
						moduleAttrHtml += '<option selected value="1">合</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					on_off_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}


				if (attrType == 'fontNew') { //字体选择 和字号放在一起节约空间
					//字体
					var fontFamily = moudleShape.getAttr("fontFamily");
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div style="width:123px;margin-left: 5px;float: left;" class="layui-input-block">' +
						'<select name="select_font_' + attrWhere.split(",")[0] +
						'_new" lay-filter="select_font_' + attrWhere.split(",")[0] + '_new">'
					moduleAttrHtml += '<option value="仿宋_GB2312">仿宋_GB2312</option>';
					moduleAttrHtml += '<optgroup label="文字字体">';
					for (var z = 0; z < initjson.fontText.length; z++) {
						if (initjson.fontText[z] == fontFamily) {
							moduleAttrHtml += '<option selected style=font-family:' + initjson.fontText[z] +
								' value="' + initjson.fontText[z] + '">' + initjson.fontText[z] + '</option>';
							// moduleAttrHtml+= '<option selected value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						} else {
							moduleAttrHtml += '<option style=font-family:' + initjson.fontText[z] + ' value="' +
								initjson.fontText[z] + '">' + initjson.fontText[z] + '</option>';
							//moduleAttrHtml+= '<option  value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						}
					}
					moduleAttrHtml += '</optgroup>';
					moduleAttrHtml += '<optgroup label="数字字体">';
					for (var z = 0; z < initjson.fontNum.length; z++) {
						if (initjson.fontNum[z] == fontFamily) {
							moduleAttrHtml += '<option selected style=font-family:' + initjson.fontNum[z] +
								' value="' + initjson.fontNum[z] + '">' + initjson.fontNum[z] + '</option>';
							// moduleAttrHtml+= '<option selected value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						} else {
							moduleAttrHtml += '<option style=font-family:' + initjson.fontNum[z] + ' value="' +
								initjson.fontNum[z] + '">' + initjson.fontNum[z] + '</option>';
							//moduleAttrHtml+= '<option  value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						}
					}
					moduleAttrHtml += '</optgroup>';
					moduleAttrHtml += '</select>' +
						'</div>';
					//字号
					var fontSize = moudleShape.getAttr("fontSize");
					moduleAttrHtml +=
						'<div style="width:55px;float: left;margin-left:0px" data-title="字号" class="layui-input-block butTips_attr">' +
						'<select name="selectNew_' + attrWhere.split(",")[0] +
						'_fontSize" lay-filter="selectNew_' + attrWhere.split(",")[0] + '_fontSize">';
					for (var z = 0; z < initjson.fontSize.length; z++) {
						if (initjson.fontSize[z] == fontSize) {
							moduleAttrHtml += '<option selected value="' + initjson.fontSize[z] + '">' +
								initjson.fontSize[z] + '</option>';
						} else {
							moduleAttrHtml += '<option  value="' + initjson.fontSize[z] + '">' + initjson
								.fontSize[z] + '</option>';
						}


					}
					moduleAttrHtml += '</select>' +
						'</div>';
					//字体颜色
					var fontColor = moudleShape.getAttr("fill");
					moduleAttrHtml +=
						'<div class="layui-input-inline" style="margin-left: 85px;width: 50px;">' +
						'<input type="text" style="width: 50px;" value="' + fontColor +
						'" placeholder="请选择颜色" class="layui-input" id="fillNew_' + attrWhere.split(",")[0] +
						'_input_color">' +
						'</div>' +
						'<div class="layui-inline" style="float: left;margin-bottom: 0px; margin-right: 0px;left: -11px;">' +
						'<div style="margin-bottom: 0px;margin-right: 0px;" id="fillNew_' + attrWhere.split(
							",")[0] + '_ico_color"></div>' +
						'</div>';

					//字体样式，正常，粗体，斜体
					var fontStyle = moudleShape.getAttr("fontStyle");
					moduleAttrHtml += '<div class="layui-input-block" style="margin: 0px;float: left;">' +
						'<div class ="layui-btn-group">';
					if (fontStyle == 'normal') {
						moduleAttrHtml += '<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="normal" class="layui-btn  layui-btn-sm"><i class="layui-icon">&#xe642;</i></button>' +
							'<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="bold" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe62b;</i></button>' +
							'<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="italic" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe644;</i></button>';
					}
					if (fontStyle == 'bold') {
						moduleAttrHtml += '<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="normal" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe642;</i></button>' +
							'<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="bold" class="layui-btn  layui-btn-sm"><i class="layui-icon">&#xe62b;</i></button>' +
							'<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="italic" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe644;</i></button>';
					}
					if (fontStyle == 'italic') {
						moduleAttrHtml += '<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="normal" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe642;</i></button>' +
							'<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="bold" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe62b;</i></button>' +
							'<button name="' + attrWhere.split(",")[0] +
							'_fontStyle" style="width:26px;padding:4px;height: 36px;" type="button" fontStyle="italic" class="layui-btn  layui-btn-sm"><i class="layui-icon">&#xe644;</i></button>';
					}


					moduleAttrHtml += '</div>' +
						'</div>';









					moduleAttrHtml += '</div>'; //最外面的一层




					font_array_new.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'font') { //字体选择
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_font" lay-filter="select_font">'
					moduleAttrHtml += '<option value="仿宋_GB2312">仿宋_GB2312</option>';
					moduleAttrHtml += '<optgroup label="文字字体">';
					for (var z = 0; z < initjson.fontText.length; z++) {
						if (initjson.fontText[z] == attrValue) {
							moduleAttrHtml += '<option selected style=font-family:' + initjson.fontText[z] +
								' value="' + initjson.fontText[z] + '">' + initjson.fontText[z] + '</option>';
							// moduleAttrHtml+= '<option selected value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						} else {
							moduleAttrHtml += '<option style=font-family:' + initjson.fontText[z] + ' value="' +
								initjson.fontText[z] + '">' + initjson.fontText[z] + '</option>';
							//moduleAttrHtml+= '<option  value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						}
					}
					moduleAttrHtml += '</optgroup>';
					moduleAttrHtml += '<optgroup label="数字字体">';
					for (var z = 0; z < initjson.fontNum.length; z++) {
						if (initjson.fontNum[z] == attrValue) {
							moduleAttrHtml += '<option selected style=font-family:' + initjson.fontNum[z] +
								' value="' + initjson.fontNum[z] + '">' + initjson.fontNum[z] + '</option>';
							// moduleAttrHtml+= '<option selected value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						} else {
							moduleAttrHtml += '<option style=font-family:' + initjson.fontNum[z] + ' value="' +
								initjson.fontNum[z] + '">' + initjson.fontNum[z] + '</option>';
							//moduleAttrHtml+= '<option  value="'+initjson.font[z]+'">'+initjson.font[z]+'</option>';
						}
					}
					moduleAttrHtml += '</optgroup>';
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					font_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'select_dataFormat') { //当前时间的格式选择
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_dateFormat" lay-filter="select_dateFormat">';
					for (var z = 0; z < initjson.dateFormat.length; z++) {
						var dateFormatObj = initjson.dateFormat[z];
						var name = dateFormatObj.name;
						var code = dateFormatObj.value;


						if (code == attrValue) {
							moduleAttrHtml += '<option selected value="' + code + '">' + name + '</option>';
						} else {
							moduleAttrHtml += '<option  value="' + code + '">' + name + '</option>';
						}


					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					dateFormat_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'fontStyle') { //文字样式，普通，粗体，斜体
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_fontStyle" lay-filter="select_fontStyle">';
					for (var z = 0; z < initjson.fontStyle.length; z++) {
						var fontStyleObj = initjson.fontStyle[z];
						var name = fontStyleObj.name;
						var code = fontStyleObj.value;


						if (code == attrValue) {
							moduleAttrHtml += '<option selected value="' + code + '">' + name + '</option>';
						} else {
							moduleAttrHtml += '<option  value="' + code + '">' + name + '</option>';
						}


					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					fontStyle_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'fontSize') { //字号选择
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_fontSize" lay-filter="select_fontSize">';
					for (var z = 0; z < initjson.fontSize.length; z++) {
						if (initjson.fontSize[z] == attrValue) {
							moduleAttrHtml += '<option selected value="' + initjson.fontSize[z] + '">' +
								initjson.fontSize[z] + '</option>';
						} else {
							moduleAttrHtml += '<option  value="' + initjson.fontSize[z] + '">' + initjson
								.fontSize[z] + '</option>';
						}


					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					fontSize_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}
				if (attrType == 'hardwareSelect') { //数据点绑定  下拉选择方式 废弃
					var attrValueTemp = eval(attrValue)[0];
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_hardware" lay-filter="select_hardware">';
					moduleAttrHtml += '<option  value="">请选择</option>';
					for (var z = 0; z < jyzt_hardwareData.length; z++) {
						var hardwareObj = jyzt_hardwareData[z];
						if (hardwareObj.code == attrValueTemp) {
							moduleAttrHtml += '<option selected value="' + hardwareObj.code + '">' + hardwareObj
								.name + '(' + hardwareObj.code + ')</option>';
						} else {
							moduleAttrHtml += '<option  value="' + hardwareObj.code + '">' + hardwareObj.name +
								'(' + hardwareObj.code + ')</option>';
						}


					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					hardware_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'dataSourceControl') { //数据来源选择
				    if(!attrValue){attrValue="liveData"};
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_dataSourceControl" id="dataSourceControl" lay-filter="select_dataSourceControl">';
				    if('liveData'==attrValue){
						moduleAttrHtml += '<option selected  value="liveData">上报数据</option>';
						moduleAttrHtml += '<option  value="platform">系统数据</option>';
					}else if ('platform' == attrValue) {
						moduleAttrHtml += '<option   value="liveData">上报数据</option>';
						moduleAttrHtml += '<option selected value="platform">系统数据</option>';
						dataApiArray = eval("initConfig." + initjson.getDataAPIFunction + "()");
						if(['ECHART_realTimeBarGraph','ECHART_realTimeSortBar','ECHART_realTimePieGraph','ECHART_realTimeCircularGraph'].indexOf(moduleType)<0){
							dataApiArray.pop();  //末尾删除，删除变量数据分析
						}else{
							dataApiArray.splice(0,4);
						}
						//console.log(dataApiArray);
					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					dataSourceControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'dataAPIControl' ) { //接口选择选择
				    if(moduleObject.attrs.dataSourceType=="platform"){
						moduleAttrHtml += '<div class="layui-form-item" id="dataAPIItem">';
						if(attrValue=="/api/equip/info"){
							let optionId=localStorage.getItem("optionId");
							equipsArray =  eval("initConfig." + initjson.getAllEquipFunction + "("+optionId+",'platform')");
							//console.log(equipsArray);
						}
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="dataAPIItem" style="display:none;">';
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_dataAPIControl" id="dataAPIControl"  lay-filter="select_dataAPIControl">';
					     //这里动态添加选项
						 if(moduleObject.attrs.dataSourceType=="platform"){
							if(attrValue){
								for(let i=0,len=dataApiArray.length;i<len;i++){
									if(attrValue==dataApiArray[i].value){
										moduleAttrHtml += '<option selected value='+dataApiArray[i].value+'>'+dataApiArray[i].label+'</option>';
										fieldsArray=Array.from(dataApiArray[i].fields);
										fieldsArrayAll=Array.from(dataApiArray[i].fields);
									}else{
										moduleAttrHtml += '<option value='+dataApiArray[i].value+'>'+dataApiArray[i].label+'</option>';
									}
								}
							}else{
								moduleAttrHtml += '<option selected  value='+dataApiArray[0].value+'>'+dataApiArray[0].label+'</option>';
								fieldsArray=Array.from(dataApiArray[0].fields);
								fieldsArrayAll=Array.from(dataApiArray[0].fields);
								for(let i=1,len=dataApiArray.length;i<len;i++){
									moduleAttrHtml += '<option value='+dataApiArray[i].value+'>'+dataApiArray[i].label+'</option>';
								}
							}
						}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';

				    dataApiControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'totalAreaControl') { //数据来源选择
				    if(!attrValue){attrValue="thisOption"};
					let sourceType = moduleObject.attrs.dataSourceType;
					let apiType = moduleObject.attrs.dataAPIType;
					let totalArray = ["/api/index/counts","/api/alarm/counts","/api/equip/counts"];
					if(sourceType=="platform" && totalArray.indexOf(apiType)>=0){
						moduleAttrHtml += '<div class="layui-form-item" id="totalAreaItem">';
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="totalAreaItem" style="display:none;">';
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_totalAreaControl" id="totalAreaControl" lay-filter="select_totalAreaControl">';
				    if('thisOption'==attrValue){
						moduleAttrHtml += '<option selected  value="thisOption">当前项目</option>';
						moduleAttrHtml += '<option  value="allPlatform">整体平台</option>';
					}else if ('allPlatform' == attrValue) {
						moduleAttrHtml += '<option   value="thisOption">当前项目</option>';
						moduleAttrHtml += '<option selected value="allPlatform">整体平台</option>';

					}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					totalAreaControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if(attrType == 'equipIdControl'){
					let sourceType = moduleObject.attrs.dataSourceType;
					let apiType = moduleObject.attrs.dataAPIType;
					if(sourceType=="platform" && apiType=="/api/equip/info"){
						moduleAttrHtml += '<div class="layui-form-item" id="equipItem">';
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="equipItem"  style="display:none;">';
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_equipIdControl" id="equipIdControl"  lay-filter="select_equipIdControl">';
					     //这里动态添加选项
						if(sourceType=="platform" && apiType=="/api/equip/info"){
							if(Number(attrValue)){
								for(let i=0,len=equipsArray.length;i<len;i++){
									if(attrValue==equipsArray[i].value){
										moduleAttrHtml += '<option selected  value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
									}else{
										moduleAttrHtml += '<option value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
									}
								}
							}else{
								moduleAttrHtml += '<option selected  value='+equipsArray[0].value+'>'+equipsArray[0].label+'</option>';
								for(let i=1,len=equipsArray.length;i<len;i++){
									moduleAttrHtml += '<option value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
								}

							}
						}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					equipIdControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});
				}

				if (attrType == 'dateTypeControl' ) { //数据分析的时间段控制
				    let sourceType = moduleObject.attrs.dataSourceType;
				    let apiType = moduleObject.attrs.dataAPIType;
					if(sourceType=="platform" && apiType=="/api/sensor/analysis"){
						moduleAttrHtml +='<div class="layui-form-item" id="dateTypeItem">';
					}else{
						moduleAttrHtml +='<div class="layui-form-item" id="dateTypeItem" style="display:none;">';
					}
				     moduleAttrHtml += '<label class="layui-form-label">' + attrName + '</label>' +
				     	'<div class="layui-input-block">' +
				     	'<select name="select_dateTypeControl"  lay-filter="select_dateTypeControl">';
				     if('last_hour'==attrValue){
				     	moduleAttrHtml += '<option selected  value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option  value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option  value="last_month">上月</option>';
				     	moduleAttrHtml += '<option  value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option  value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option  value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option  value="curr_month">本月</option>';
				     }else if ('last_day' == attrValue) {
				     	moduleAttrHtml += '<option   value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option selected value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option  value="last_month">上月</option>';
				     	moduleAttrHtml += '<option  value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option  value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option  value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option  value="curr_month">本月</option>';
				     }else if ('last_week' == attrValue) {
				     	moduleAttrHtml += '<option  value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option  value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option selected  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option  value="last_month">上月</option>';
				     	moduleAttrHtml += '<option  value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option  value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option  value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option  value="curr_month">本月</option>';
				     }else if ('last_month' == attrValue) {
				     	moduleAttrHtml += '<option   value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option  value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option selected value="last_month">上月</option>';
				     	moduleAttrHtml += '<option  value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option  value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option  value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option  value="curr_month">本月</option>';
				     }else if ('curr_hour' == attrValue) {
				     	moduleAttrHtml += '<option   value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option  value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option  value="last_month">上月</option>';
				     	moduleAttrHtml += '<option selected value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option  value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option  value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option  value="curr_month">本月</option>';
				     }else if('curr_day' == attrValue){
				     	moduleAttrHtml += '<option   value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option  value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option  value="last_month">上月</option>';
				     	moduleAttrHtml += '<option  value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option selected value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option  value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option  value="curr_month">本月</option>';
				     }else if('curr_week' == attrValue){
				     	moduleAttrHtml += '<option   value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option  value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option  value="last_month">上月</option>';
				     	moduleAttrHtml += '<option  value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option  value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option selected value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option  value="curr_month">本月</option>';
				     }else if('curr_month' == attrValue){
				     	moduleAttrHtml += '<option   value="last_hour">上一小时</option>';
				     	moduleAttrHtml += '<option  value="last_day">昨日</option>';
				     	moduleAttrHtml += '<option  value="last_week">上周</option>';
				     	moduleAttrHtml += '<option  value="last_month">上月</option>';
				     	moduleAttrHtml += '<option  value="curr_hour">当前小时</option>';
				     	moduleAttrHtml += '<option  value="curr_day">今日</option>';
				     	moduleAttrHtml += '<option  value="curr_week">本周</option>';
				     	moduleAttrHtml += '<option selected value="curr_month">本月</option>';
				     }

				     moduleAttrHtml += '</select>' +
				     	'</div>' +
				     	'</div>';
				    dateTypeControl_array.push({
				     	attrCode: attrCode,
				     	attrValue: attrValue,
				     	attrWhere: attrWhere
				     });
				}

				if (attrType == 'functionControl' ) { //数据分析的算法控制
				    let sourceType = moduleObject.attrs.dataSourceType;
				    let apiType = moduleObject.attrs.dataAPIType;
				    if(sourceType=="platform" && apiType=="/api/sensor/analysis"){
				    	moduleAttrHtml +='<div class="layui-form-item" id="functionItem">';
				    }else{
				    	moduleAttrHtml +='<div class="layui-form-item" id="functionItem" style="display:none;">';
				    }
				     moduleAttrHtml += '<label class="layui-form-label">' + attrName + '</label>' +
				     	'<div class="layui-input-block">' +
				     	'<select name="select_functionControl"  lay-filter="select_functionControl">';
				     if('max'==attrValue){
				     	moduleAttrHtml += '<option selected  value="max">最大值</option>';
				     	moduleAttrHtml += '<option  value="min">最小值</option>';
				     	moduleAttrHtml += '<option  value="mean">平均值</option>';
				     	moduleAttrHtml += '<option  value="spread">增量</option>';
				     	moduleAttrHtml += '<option  value="ratio">增长率</option>';
				     }else if ('min' == attrValue) {
				     	moduleAttrHtml += '<option  value="max">最大值</option>';
				     	moduleAttrHtml += '<option selected value="min">最小值</option>';
				     	moduleAttrHtml += '<option  value="mean">平均值</option>';
				     	moduleAttrHtml += '<option  value="spread">增量</option>';
				     	moduleAttrHtml += '<option  value="ratio">增长率</option>';
				     }else if ('mean' == attrValue) {
				     	moduleAttrHtml += '<option   value="max">最大值</option>';
				     	moduleAttrHtml += '<option  value="min">最小值</option>';
				     	moduleAttrHtml += '<option selected value="mean">平均值</option>';
				     	moduleAttrHtml += '<option  value="spread">增量</option>';
				     	moduleAttrHtml += '<option  value="ratio">增长率</option>';
				     }else if ('spread' == attrValue) {
				     	moduleAttrHtml += '<option   value="max">最大值</option>';
				     	moduleAttrHtml += '<option  value="min">最小值</option>';
				     	moduleAttrHtml += '<option  value="mean">平均值</option>';
				     	moduleAttrHtml += '<option selected value="spread">增量</option>';
				     	moduleAttrHtml += '<option  value="ratio">增长率</option>';
				    }else if ('ratio' == attrValue) {
				     	moduleAttrHtml += '<option  value="max">最大值</option>';
				     	moduleAttrHtml += '<option  value="min">最小值</option>';
				     	moduleAttrHtml += '<option  value="mean">平均值</option>';
				     	moduleAttrHtml += '<option  value="spread">增量</option>';
				     	moduleAttrHtml += '<option selected value="ratio">增长率</option>';
				    }

				     moduleAttrHtml += '</select>' +
				     	'</div>' +
				     	'</div>';
				    functionControl_array.push({
				     	attrCode: attrCode,
				     	attrValue: attrValue,
				     	attrWhere: attrWhere
				     });
				}

				if (attrType == 'fieldControl' ) { //字段选择
				    if(moduleObject.attrs.dataSourceType=="platform" && moduleObject.attrs.dataAPIType!="/api/sensor/analysis"){
						moduleAttrHtml += '<div class="layui-form-item" id="fieldItem">'
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="fieldItem"  style="display:none;">'
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_fieldControl" id="fieldControl"  lay-filter="select_fieldControl">';
					     //这里动态添加选项
						if(moduleObject.attrs.dataSourceType=="platform"){
							if(attrValue){
							    for(let i=0,len=fieldsArray.length;i<len;i++){
									if(attrValue==fieldsArray[i].key){
										moduleAttrHtml += '<option selected  value='+fieldsArray[i].key+'>'+fieldsArray[i].label+'</option>';
									}else{
										moduleAttrHtml += '<option value='+fieldsArray[i].key+'>'+fieldsArray[i].label+'</option>';
									}
								}
							}else{
								moduleAttrHtml += '<option selected  value='+fieldsArray[0].key+'>'+fieldsArray[0].label+'</option>';
								for(let i=1,len=fieldsArray.length;i<len;i++){
									moduleAttrHtml += '<option value='+fieldsArray[i].key+'>'+fieldsArray[i].label+'</option>';
								}

							}
						}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					dataFieldControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'pageSizeControl') { //监控面板表每页条数
				    if(['data','historyChart','analysis','statement'].indexOf(moduleObject.attrs.tabTypes)>=0){
						moduleAttrHtml += '<div class="layui-form-item" id="pageSizeItem" style="display:none;">';
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="pageSizeItem">';
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_pageSizeControl" lay-filter="select_pageSizeControl">';

					if ('5' == attrValue) {
						moduleAttrHtml += '<option selected  value="5">每页5条</option>';
						moduleAttrHtml += '<option  value="10">每页10条</option>';
						moduleAttrHtml += '<option  value="15">每页15条</option>';
						moduleAttrHtml += '<option  value="20">每页20条</option>';
						moduleAttrHtml += '<option  value="25">每页25条</option>';
					} else if ('10' == attrValue) {
						moduleAttrHtml += '<option   value="5">每页5条</option>';
						moduleAttrHtml += '<option selected value="10">每页10条</option>';
						moduleAttrHtml += '<option  value="15">每页15条</option>';
						moduleAttrHtml += '<option  value="20">每页20条</option>';
						moduleAttrHtml += '<option  value="25">每页25条</option>';
					} else if ('15' == attrValue) {
						moduleAttrHtml += '<option  value="5">每页5条</option>';
						moduleAttrHtml += '<option  value="10">每页10条</option>';
						moduleAttrHtml += '<option selected  value="15">每页15条</option>';
						moduleAttrHtml += '<option  value="20">每页20条</option>';
						moduleAttrHtml += '<option  value="25">每页25条</option>';
					} else if ('20' == attrValue) {
						moduleAttrHtml += '<option  value="5">每页5条</option>';
						moduleAttrHtml += '<option  value="10">每页10条</option>';
						moduleAttrHtml += '<option  value="15">每页15条</option>';
						moduleAttrHtml += '<option selected value="20">每页20条</option>';
						moduleAttrHtml += '<option  value="25">每页25条</option>';
					} else if ('25' == attrValue) {
						moduleAttrHtml += '<option  value="5">每页5条</option>';
						moduleAttrHtml += '<option  value="10">每页10条</option>';
						moduleAttrHtml += '<option  value="15">每页15条</option>';
						moduleAttrHtml += '<option  value="20">每页20条</option>';
						moduleAttrHtml += '<option selected value="25">每页25条</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					pageSizeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'showTypeControl') { //监控面板历史数据显示方式控制
					if (moduleObject.attrs.tabTypes == "historyData") {
						moduleAttrHtml += '<div class="layui-form-item" id="showTypeItem">';
					} else {
						moduleAttrHtml +=
							'<div class="layui-form-item" id="showTypeItem" style="display:none;">';
					}
					moduleAttrHtml += '<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block"  >' +
						'<select name="select_showTypeControl" lay-filter="select_showTypeControl">';

					if ('table' == attrValue) {
						moduleAttrHtml += '<option selected  value="table">数据报表</option>';
						moduleAttrHtml += '<option  value="echart">历史曲线</option>';
					} else if ('echart' == attrValue) {
						moduleAttrHtml += '<option   value="table">数据报表</option>';
						moduleAttrHtml += '<option selected value="echart">历史曲线</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					showTypeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}


				if (attrType == 'readWriteControl') { //读写控制
                    if(moduleObject.attrs.dataSourceType=="liveData"){
						moduleAttrHtml += '<div class="layui-form-item">';
					}else if(moduleObject.attrs.dataSourceType=="platform"){
						moduleAttrHtml += '<div class="layui-form-item" style="display:none;">';
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_readWriteControl" lay-filter="select_readWriteControl">';

					if ('1' == attrValue) {
						moduleAttrHtml += '<option selected  value="1">只读</option>';
						moduleAttrHtml += '<option  value="2">读写</option>';
					} else if ('2' == attrValue) {
						moduleAttrHtml += '<option value="1">只读</option>';
						moduleAttrHtml += '<option selected value="2">读写</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					readWriteControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'labelValueWidthControl') { //文本标签变量，宽度控制
				    moduleAttrHtml += '<div class="layui-form-item">';
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_labelValueWidthControl" lay-filter="select_labelValueWidthControl">';
				    if ('auto' == attrValue) {
						moduleAttrHtml += '<option selected  value="auto">自适应</option>';
						moduleAttrHtml += '<option  value="set">固定设置</option>';
					} else if ('set' == attrValue) {
						moduleAttrHtml += '<option   value="auto">自适应</option>';
						moduleAttrHtml += '<option selected value="set">固定设置</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					labelValueWidthControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'alignTypeControl') { //文本变量整体对齐方式
				    if(moduleObject.attrs.labelValueWidth=="auto"){
				        moduleAttrHtml += '<div class="layui-form-item" id="alignTypeControl" style="display:none">';
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="alignTypeControl">';
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_alignTypeControl" lay-filter="select_alignTypeControl">';
				    if ('left' == attrValue) {
						moduleAttrHtml += '<option selected  value="left">左对齐</option>';
						moduleAttrHtml += '<option  value="right">右对齐</option>';
						moduleAttrHtml += '<option  value="center">居中对齐</option>';
						moduleAttrHtml += '<option  value="justify">两端对齐</option>';
					} else if ('right' == attrValue) {
						moduleAttrHtml += '<option   value="left">左对齐</option>';
						moduleAttrHtml += '<option selected value="right">右对齐</option>';
						moduleAttrHtml += '<option  value="center">居中对齐</option>';
						moduleAttrHtml += '<option  value="justify">两端对齐</option>';
					}else if('center' == attrValue){
						moduleAttrHtml += '<option   value="left">左对齐</option>';
						moduleAttrHtml += '<option  value="right">右对齐</option>';
						moduleAttrHtml += '<option selected value="center">居中对齐</option>';
						moduleAttrHtml += '<option  value="justify">两端对齐</option>';
					}else if('justify' == attrValue){
						moduleAttrHtml += '<option   value="left">左对齐</option>';
						moduleAttrHtml += '<option  value="right">右对齐</option>';
						moduleAttrHtml += '<option  value="center">居中对齐</option>';
						moduleAttrHtml += '<option selected value="justify">两端对齐</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					alignTypeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'changeTypeControl') { //跳转方式

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_changeTypeControl" lay-filter="select_changeTypeControl">';

					if ('normal' == attrValue) {
						moduleAttrHtml += '<option selected  value="normal">默认</option>';
						moduleAttrHtml += '<option  value="newWindow">弹出新窗口</option>';
					} else if ('newWindow' == attrValue) {
						moduleAttrHtml += '<option value="normal">默认</option>';
						moduleAttrHtml += '<option selected value="newWindow">弹出新窗口</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					changeTypeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'resetTypeControl') { //复位类型

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_resetTypeControl" lay-filter="select_resetTypeControl">';

					if ('1' == attrValue) {
						moduleAttrHtml += '<option selected  value="1">先置1后置0</option>';
						moduleAttrHtml += '<option  value="2">先置0后置1</option>';
					} else if ('2' == attrValue) {
						moduleAttrHtml += '<option value="1">先置1后置0</option>';
						moduleAttrHtml += '<option selected value="2">先置0后置1</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					resetTypeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'refreshTypeControl') { //刷新方式
				    if(dataSourceType=="platform"){
						moduleAttrHtml +='<div class="layui-form-item" id="refreshTypeItem">';
					}else{
						moduleAttrHtml +='<div class="layui-form-item" id="refreshTypeItem" style="display:none;">';
					}
					moduleAttrHtml +=
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_refreshTypeControl" lay-filter="select_refreshTypeControl">';

					if ('0' == attrValue) {
						moduleAttrHtml += '<option selected  value="0">手动刷新</option>';
						moduleAttrHtml += '<option  value="60">每隔1分钟刷新</option>';
						moduleAttrHtml += '<option  value="600">每隔10分钟刷新</option>';
						moduleAttrHtml += '<option  value="1800">每隔30分钟刷新</option>';
						moduleAttrHtml += '<option  value="3600">每隔1小时刷新</option>';
					} else if ('60' == attrValue) {
						moduleAttrHtml += '<option value="0">手动刷新</option>';
						moduleAttrHtml += '<option selected value="60">每隔1分钟刷新</option>';
						moduleAttrHtml += '<option  value="600">每隔10分钟刷新</option>';
						moduleAttrHtml += '<option  value="1800">每隔30分钟刷新</option>';
						moduleAttrHtml += '<option  value="3600">每隔1小时刷新</option>';
					}else if ('600' == attrValue) {
						moduleAttrHtml += '<option value="0">手动刷新</option>';
						moduleAttrHtml += '<option value="60">每隔1分钟刷新</option>';
						moduleAttrHtml += '<option  selected value="600">每隔10分钟刷新</option>';
						moduleAttrHtml += '<option  value="1800">每隔30分钟刷新</option>';
						moduleAttrHtml += '<option  value="3600">每隔1小时刷新</option>';
					}else if ('1800' == attrValue) {
						moduleAttrHtml += '<option value="0">手动刷新</option>';
						moduleAttrHtml += '<option value="60">每隔1分钟刷新</option>';
						moduleAttrHtml += '<option  selected value="600">每隔10分钟刷新</option>';
						moduleAttrHtml += '<option  value="1800">每隔30分钟刷新</option>';
						moduleAttrHtml += '<option  value="3600">每隔1小时刷新</option>';
					}else if ('3600' == attrValue) {
						moduleAttrHtml += '<option value="0">手动刷新</option>';
						moduleAttrHtml += '<option value="60">每隔1分钟刷新</option>';
						moduleAttrHtml += '<option value="600">每隔10分钟刷新</option>';
						moduleAttrHtml += '<option  value="1800">每隔30分钟刷新</option>';
						moduleAttrHtml += '<option selected  value="3600">每隔1小时刷新</option>';
					}


					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					refreshTypeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'tabTypesControl') { //监控模块选择

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_tabTypesControl"  lay-filter="select_tabTypesControl">';
				    if('data'==attrValue){
						moduleAttrHtml += '<option selected  value="data">实时数据</option>';
						moduleAttrHtml += '<option  value="historyData">历史数据</option>';
						// moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
						// moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
						moduleAttrHtml += '<option  value="analysis">数据分析</option>';
            moduleAttrHtml += '<option  value="statement">数据报表</option>';
						moduleAttrHtml += '<option  value="alarm">报警记录</option>';
						moduleAttrHtml += '<option  value="log">操作记录</option>';
						moduleAttrHtml += '<option  value="device">设备列表</option>';
					}else if ('historyData' == attrValue) {
						moduleAttrHtml += '<option value="data">实时数据</option>';
						moduleAttrHtml += '<option selected value="historyData">历史数据</option>';
						// moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
						// moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
						moduleAttrHtml += '<option  value="analysis">数据分析</option>';
            moduleAttrHtml += '<option  value="statement">数据报表</option>';
						moduleAttrHtml += '<option  value="alarm">报警记录</option>';
						moduleAttrHtml += '<option  value="log">操作记录</option>';
						moduleAttrHtml += '<option  value="device">设备列表</option>';
					// }else if ('historyTable' == attrValue) {
					// 	moduleAttrHtml += '<option value="data">实时数据</option>';
					// 	moduleAttrHtml += '<option value="historyData">历史数据</option>';
					// 	// moduleAttrHtml += '<option selected  value="historyTable">历史报表</option>';
					// 	// moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
					// 	moduleAttrHtml += '<option  value="analysis">数据分析</option>';
					// 	moduleAttrHtml += '<option  value="alarm">报警记录</option>';
					// 	moduleAttrHtml += '<option  value="log">操作记录</option>';
					// 	moduleAttrHtml += '<option  value="device">设备列表</option>';
					// }else if ('historyChart' == attrValue) {
					// 	moduleAttrHtml += '<option value="data">实时数据</option>';
					// 	moduleAttrHtml += '<option value="historyData">历史数据</option>';
					// 	moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
					// 	moduleAttrHtml += '<option selected  value="historyChart">历史曲线</option>';
					// 	moduleAttrHtml += '<option  value="analysis">数据分析</option>';
					// 	moduleAttrHtml += '<option  value="alarm">报警记录</option>';
					// 	moduleAttrHtml += '<option  value="log">操作记录</option>';
					// 	moduleAttrHtml += '<option  value="device">设备列表</option>';
					//
					}else if ('analysis' == attrValue) {
						moduleAttrHtml += '<option value="data">实时数据</option>';
						moduleAttrHtml += '<option value="historyData">历史数据</option>';
						//moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
						//moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
						moduleAttrHtml += '<option selected value="analysis">数据分析</option>';
            moduleAttrHtml += '<option  value="statement">数据报表</option>';
						moduleAttrHtml += '<option  value="alarm">报警记录</option>';
						moduleAttrHtml += '<option  value="log">操作记录</option>';
						moduleAttrHtml += '<option  value="device">设备列表</option>';
					}else if ('statement' == attrValue) {
						moduleAttrHtml += '<option value="data">实时数据</option>';
						moduleAttrHtml += '<option value="historyData">历史数据</option>';
						//moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
						//moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
						moduleAttrHtml += '<option  value="analysis">数据分析</option>';
            moduleAttrHtml += '<option selected value="statement">数据报表</option>';
						moduleAttrHtml += '<option  value="alarm">报警记录</option>';
						moduleAttrHtml += '<option  value="log">操作记录</option>';
						moduleAttrHtml += '<option  value="device">设备列表</option>';
					}else if('alarm' == attrValue){
						moduleAttrHtml += '<option value="data">实时数据</option>';
						moduleAttrHtml += '<option value="historyData">历史数据</option>';
						//moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
						//moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
						moduleAttrHtml += '<option  value="analysis">数据分析</option>';
            moduleAttrHtml += '<option  value="statement">数据报表</option>';
						moduleAttrHtml += '<option  selected value="alarm">报警记录</option>';
						moduleAttrHtml += '<option  value="log">操作记录</option>';
						moduleAttrHtml += '<option  value="device">设备列表</option>';
					}else if('log' == attrValue){
						moduleAttrHtml += '<option value="data">实时数据</option>';
						moduleAttrHtml += '<option value="historyData">历史数据</option>';
						//moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
						//moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
						moduleAttrHtml += '<option  value="analysis">数据分析</option>';
            moduleAttrHtml += '<option  value="statement">数据报表</option>';
						moduleAttrHtml += '<option  value="alarm">报警记录</option>';
						moduleAttrHtml += '<option selected value="log">操作记录</option>';
						moduleAttrHtml += '<option  value="device">设备列表</option>';
					}else if('device' == attrValue){
						moduleAttrHtml += '<option value="data">实时数据</option>';
						moduleAttrHtml += '<option value="historyData">历史数据</option>';
						//moduleAttrHtml += '<option  value="historyTable">历史报表</option>';
						//moduleAttrHtml += '<option  value="historyChart">历史曲线</option>';
						moduleAttrHtml += '<option  value="analysis">数据分析</option>';
            moduleAttrHtml += '<option  value="statement">数据报表</option>';
						moduleAttrHtml += '<option  value="alarm">报警记录</option>';
						moduleAttrHtml += '<option  value="log">操作记录</option>';
						moduleAttrHtml += '<option selected value="device">设备列表</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					tabTypesControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if(attrType == 'showStyleControl'){  //面板风格样式选择
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_showStyleControl"  lay-filter="select_showStyleControl">';
					if('normal'==attrValue){
						moduleAttrHtml += '<option selected  value="normal">简约黑白</option>';
						moduleAttrHtml += '<option  value="dark">白字透底</option>';

					}else if ('dark' == attrValue) {
						moduleAttrHtml += '<option  value="normal">简约黑白</option>';
						moduleAttrHtml += '<option selected value="dark">白字透底</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					showStyleControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});
				}


				if(attrType == 'mapUseControl'){
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_mapUseControl"  lay-filter="select_mapUseControl">';
					if('location'==attrValue){
						moduleAttrHtml += '<option selected  value="location">设备定位</option>';
						moduleAttrHtml += '<option  value="locus">设备轨迹</option>';

					}else if ('locus' == attrValue) {
						moduleAttrHtml += '<option  value="location">设备定位</option>';
						moduleAttrHtml += '<option selected value="locus">设备轨迹</option>';
						let optionId=localStorage.getItem("optionId");
						equipsArray =  eval("initConfig." + initjson.getAllEquipFunction + "("+optionId+",'map')");
						console.log(equipsArray);
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					mapUseControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});
				}

				if(attrType == 'equipMapControl'){
					let mapUse = moduleObject.attrs.setUse;
					if(mapUse=="locus"){
						moduleAttrHtml += '<div class="layui-form-item" id="equipMapItem">';
					}else{
						moduleAttrHtml += '<div class="layui-form-item" id="equipMapItem"  style="display:none;">';
					}
					moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_equipMapControl" id="equipMapControl"  lay-filter="select_equipMapControl">';
					     //这里动态添加选项
						if(mapUse=="locus"){
							if(Number(attrValue)){
								if(equipsArray.length){
									for(let i=0,len=equipsArray.length;i<len;i++){
										if(attrValue==equipsArray[i].value){
											moduleAttrHtml += '<option selected  value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
										}else{
											moduleAttrHtml += '<option value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
										}
									}
								}
							}else{
								if(equipsArray.length){
									moduleAttrHtml += '<option selected  value='+equipsArray[0].value+'>'+equipsArray[0].label+'</option>';
									for(let i=1,len=equipsArray.length;i<len;i++){
										moduleAttrHtml += '<option value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
									}

								}
							}
						}
					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					equipMapControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});
				}

				if (attrType == 'mapStyleControl') { //地图风格选择

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_mapStyleControl"  lay-filter="select_mapStyleControl">';
				    if('normal'==attrValue){
						moduleAttrHtml += '<option selected  value="normal">常规默认</option>';
						moduleAttrHtml += '<option  value="dark">暗灰</option>';
						moduleAttrHtml += '<option  value="light">明亮</option>';
						moduleAttrHtml += '<option  value="fresh">清新</option>';
						moduleAttrHtml += '<option  value="grey">烟灰色</option>';
						moduleAttrHtml += '<option  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option  value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option  value="darkblue">蓝黑过渡</option>';
					}else if ('dark' == attrValue) {
						moduleAttrHtml += '<option  value="normal">常规默认</option>';
						moduleAttrHtml += '<option selected value="dark">暗灰</option>';
						moduleAttrHtml += '<option  value="light">明亮</option>';
						moduleAttrHtml += '<option  value="fresh">清新</option>';
						moduleAttrHtml += '<option  value="grey">烟灰色</option>';
						moduleAttrHtml += '<option  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option  value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option  value="darkblue">蓝黑过渡</option>';
					} else if ('light' == attrValue) {
						moduleAttrHtml += '<option  value="normal">常规默认</option>';
						moduleAttrHtml += '<option  value="dark">暗灰</option>';
						moduleAttrHtml += '<option selected value="light">明亮</option>';
						moduleAttrHtml += '<option  value="fresh">清新</option>';
						moduleAttrHtml += '<option  value="grey">烟灰色</option>';
						moduleAttrHtml += '<option  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option  value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option  value="darkblue">蓝黑过渡</option>';
					}else if('fresh' == attrValue){
						moduleAttrHtml += '<option  value="normal">常规默认</option>';
						moduleAttrHtml += '<option  value="dark">暗灰</option>';
						moduleAttrHtml += '<option  value="light">明亮</option>';
						moduleAttrHtml += '<option selected value="fresh">清新</option>';
						moduleAttrHtml += '<option  value="grey">烟灰色</option>';
						moduleAttrHtml += '<option  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option  value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option  value="darkblue">蓝黑过渡</option>';
					}else if('grey' == attrValue){
						moduleAttrHtml += '<option  value="normal">常规默认</option>';
						moduleAttrHtml += '<option  value="dark">暗灰</option>';
						moduleAttrHtml += '<option  value="light">明亮</option>';
						moduleAttrHtml += '<option  value="fresh">清新</option>';
						moduleAttrHtml += '<option selected value="grey">烟灰色</option>';
						moduleAttrHtml += '<option  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option  value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option  value="darkblue">蓝黑过渡</option>';
					}else if('macaron' == attrValue){
						moduleAttrHtml += '<option  value="normal">常规默认</option>';
						moduleAttrHtml += '<option  value="dark">暗灰</option>';
						moduleAttrHtml += '<option  value="light">明亮</option>';
						moduleAttrHtml += '<option  value="fresh">清新</option>';
						moduleAttrHtml += '<option  value="grey">烟灰色</option>';
						moduleAttrHtml += '<option selected  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option  value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option  value="darkblue">蓝黑过渡</option>';
					}else if('blue' == attrValue){
						moduleAttrHtml += '<option  value="normal">常规默认</option>';
						moduleAttrHtml += '<option  value="dark">暗灰</option>';
						moduleAttrHtml += '<option  value="light">明亮</option>';
						moduleAttrHtml += '<option  value="fresh">清新</option>';
						moduleAttrHtml += '<option  value="grey">烟灰色</option>';
						moduleAttrHtml += '<option  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option selected value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option  value="darkblue">蓝黑过渡</option>';
					}else if('darkblue' == attrValue){
						moduleAttrHtml += '<option  value="normal">常规默认</option>';
						moduleAttrHtml += '<option  value="dark">暗灰</option>';
						moduleAttrHtml += '<option  value="light">明亮</option>';
						moduleAttrHtml += '<option  value="fresh">清新</option>';
						moduleAttrHtml += '<option  value="grey">烟灰色</option>';
						moduleAttrHtml += '<option  value="macaron">马卡龙</option>';
						moduleAttrHtml += '<option  value="blue">蓝绿过渡</option>';
						moduleAttrHtml += '<option selected value="darkblue">蓝黑过渡</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					mapStyleControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'dateRangeControl') { //历史曲线默认时段选择

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_dateRangeControl"  lay-filter="select_dateRangeControl">';
				    if('1'==attrValue){
						moduleAttrHtml += '<option selected  value="1">今日</option>';
						moduleAttrHtml += '<option  value="3">最近三天</option>';
						moduleAttrHtml += '<option  value="7">最近一周</option>';
						moduleAttrHtml += '<option  value="10">最近十天</option>';
						moduleAttrHtml += '<option  value="15">最近半月</option>';
					}else if ('3' == attrValue) {
						moduleAttrHtml += '<option  value="1">今日</option>';
						moduleAttrHtml += '<option  selected value="3">最近三天</option>';
						moduleAttrHtml += '<option  value="7">最近一周</option>';
						moduleAttrHtml += '<option  value="10">最近十天</option>';
						moduleAttrHtml += '<option  value="15">最近半月</option>';
					} else if ('7' == attrValue) {
						moduleAttrHtml += '<option  value="1">今日</option>';
						moduleAttrHtml += '<option  value="3">最近三天</option>';
						moduleAttrHtml += '<option selected value="7">最近一周</option>';
						moduleAttrHtml += '<option  value="10">最近十天</option>';
						moduleAttrHtml += '<option  value="15">最近半月</option>';
					}else if('10' == attrValue){
						moduleAttrHtml += '<option  value="1">今日</option>';
						moduleAttrHtml += '<option  value="3">最近三天</option>';
						moduleAttrHtml += '<option  value="7">最近一周</option>';
						moduleAttrHtml += '<option selected value="10">最近十天</option>';
						moduleAttrHtml += '<option  value="15">最近半月</option>';
					}else if('15' == attrValue){
						moduleAttrHtml += '<option  value="1">今日</option>';
						moduleAttrHtml += '<option  value="3">最近三天</option>';
						moduleAttrHtml += '<option  value="7">最近一周</option>';
						moduleAttrHtml += '<option  value="10">最近十天</option>';
						moduleAttrHtml += '<option selected value="15">最近半月</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					dateRangeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'videoModeControl') { //历史曲线默认时段选择

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_videoModeControl"  lay-filter="select_videoModeControl">';
				    if('standard'==attrValue){
						moduleAttrHtml += '<option selected  value="standard">标准版</option>';
						moduleAttrHtml += '<option  value="simple">极简版</option>';
						moduleAttrHtml += '<option  value="security">安防版</option>';
						moduleAttrHtml += '<option  value="voice">语音版</option>';
						moduleAttrHtml += '<option  value="theme">控制版</option>';
					}else if('simple'==attrValue){
						moduleAttrHtml += '<option  value="standard">标准版</option>';
						moduleAttrHtml += '<option selected  value="simple">极简版</option>';
						moduleAttrHtml += '<option  value="security">安防版</option>';
						moduleAttrHtml += '<option  value="voice">语音版</option>';
						moduleAttrHtml += '<option  value="theme">控制版</option>';
					}else if ('security' == attrValue) {
						moduleAttrHtml += '<option   value="standard">标准版</option>';
						moduleAttrHtml += '<option   value="simple">极简版</option>';
						moduleAttrHtml += '<option selected value="security">安防版</option>';
						moduleAttrHtml += '<option  value="voice">语音版</option>';
						moduleAttrHtml += '<option  value="theme">控制版</option>';
					} else if ('voice' == attrValue) {
						moduleAttrHtml += '<option   value="standard">标准版</option>';
						moduleAttrHtml += '<option   value="simple">极简版</option>';
						moduleAttrHtml += '<option  value="security">安防版</option>';
						moduleAttrHtml += '<option selected value="voice">语音版</option>';
						moduleAttrHtml += '<option  value="theme">控制版</option>';
					}else if('theme' == attrValue){
						moduleAttrHtml += '<option   value="standard">标准版</option>';
						moduleAttrHtml += '<option   value="simple">极简版</option>';
						moduleAttrHtml += '<option  value="security">安防版</option>';
						moduleAttrHtml += '<option  value="voice">语音版</option>';
						moduleAttrHtml += '<option selected value="theme">控制版</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					moduleAttrHtml +=
						'<div>说明：</br>1.目前支持的监控摄像头品牌：萤石，海康(部分型号)；'+
						'</br>2.高级监控目前不支持在微信小程序中显示，请慎用。相比实时监控高级监控有着更友好的播放界面和最低的延时。</div>'	+
						'3.如果只是简单的视频监控，界面模板选择标准版即可；如果摄像头支持语音对讲，可选择语音版；如果你的摄像头支持并已开通云存储或带有存储卡，可选择安防版以实现视频回放；如果你的摄像头支持可控制旋转(常见于球机)，可选择控制板。</div>';
					videoModeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}


				if(attrType == 'insertTypeControl'){
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_insertTypeControl"  lay-filter="select_insertTypeControl">';
					if('web'==attrValue){
						$("#insertIframe").css("display","block");
						moduleAttrHtml += '<option selected  value="web">网页</option>';
						moduleAttrHtml += '<option  value="view">图纸</option>';

					}else if ('view' == attrValue) {
						moduleAttrHtml += '<option   value="web">网页</option>';
						moduleAttrHtml += '<option selected value="view">图纸</option>';
						$("#insertIframe").css("display","none");
						insertViewArray = eval("initConfig.getDrawsMoudleData(" + localStorage.getItem('editViewId') + ")");
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					insertTypeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});
				}


				if(attrType == 'insertViewControl'){
					let insertType = moduleObject.attrs.insertType;
					    if(insertType=="view"){
						    moduleAttrHtml += '<div class="layui-form-item" id="insertViewItem">';
							$("#insertIframe").css("display","none");
						}else{
							moduleAttrHtml += '<div class="layui-form-item" id="insertViewItem"  style="display:none;">';
						}
						moduleAttrHtml +='<label class="layui-form-label">' + attrName + '</label>' +
							'<div class="layui-input-block">' +
							'<select name="select_insertViewControl" id="insertViewControl"  lay-filter="select_insertViewControl">';
							//这里动态添加选项
							if(insertType=="view"){
								if(Number(attrValue)){
									if(insertViewArray.length){
										for(let i=0,len=insertViewArray.length;i<len;i++){
											if(attrValue==insertViewArray[i].id){
												moduleAttrHtml += '<option selected  value='+insertViewArray[i].id+'>'+insertViewArray[i].draw_name+'</option>';
											}else{
												moduleAttrHtml += '<option value='+insertViewArray[i].id+'>'+insertViewArray[i].draw_name+'</option>';
											}
										}
									}
								}else{
									if(insertViewArray.length){
										moduleAttrHtml += '<option selected  value='+insertViewArray[0].id+'>'+insertViewArray[0].draw_name+'</option>';
										for(let i=1,len=insertViewArray.length;i<len;i++){
											moduleAttrHtml += '<option value='+insertViewArray[i].id+'>'+insertViewArray[i].draw_name+'</option>';
										}

									}
								}
							}
						moduleAttrHtml += '</select>' +
							'</div>' +
							'</div>';
						insertViewControl_array.push({
							attrCode: attrCode,
							attrValue: attrValue,
							attrWhere: attrWhere
						});
				}


				if (attrType == 'secondControl') { //二次输入判断

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_secondControl" lay-filter="select_secondControl">';

					if ('1' == attrValue) {
						moduleAttrHtml += '<option selected  value="1">禁止</option>';
						moduleAttrHtml += '<option  value="2">开启</option>';
					} else if ('2' == attrValue) {
						moduleAttrHtml += '<option value="1">禁止</option>';
						moduleAttrHtml += '<option selected value="2">开启</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					secondControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'sortTypeControl') { //echart横条排序方式

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_sortTypeControl" lay-filter="select_sortTypeControl">';
				    if(moduleType=="ECHART_realTimeBarGraph"){  //柱状图
						if ('1' == attrValue) {
							moduleAttrHtml += '<option selected  value="1">左小右大</option>';
							moduleAttrHtml += '<option  value="2">左大右小</option>';
							moduleAttrHtml += '<option  value="0">不排序</option>';
						} else if ('2' == attrValue) {
							moduleAttrHtml += '<option value="1">左小右大</option>';
							moduleAttrHtml += '<option selected value="2">左大右小</option>';
							moduleAttrHtml += '<option  value="0">不排序</option>';
						}else if('0'==attrValue){
							moduleAttrHtml += '<option value="1">左小右大</option>';
							moduleAttrHtml += '<option value="2">左大右小</option>';
							moduleAttrHtml += '<option  selected  value="0">不排序</option>';
						}
					}else{  //横条排序
						if ('1' == attrValue) {
							moduleAttrHtml += '<option selected  value="1">上大下小</option>';
							moduleAttrHtml += '<option  value="2">上小下大</option>';
							moduleAttrHtml += '<option  value="0">不排序</option>';
						} else if ('2' == attrValue) {
							moduleAttrHtml += '<option value="1">上大下小</option>';
							moduleAttrHtml += '<option selected value="2">上小下大</option>';
							moduleAttrHtml += '<option  value="0">不排序</option>';
						}else if('0'==attrValue){
							moduleAttrHtml += '<option value="1">上大下小</option>';
							moduleAttrHtml += '<option value="2">上小下大</option>';
							moduleAttrHtml += '<option  selected  value="0">不排序</option>';
						}

					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					sortTypeControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'showTypeX') { //echart横条排序X轴显示控制

					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<select name="select_showTypeXControl" lay-filter="select_showTypeXControl">';

					if ('hidden' == attrValue) {
						moduleAttrHtml += '<option selected  value="hidden">不显示</option>';
						moduleAttrHtml += '<option  value="normal">正常显示</option>';
						moduleAttrHtml += '<option  value="point">只显示刻度标记</option>';
					} else if ('normal' == attrValue) {
						moduleAttrHtml += '<option  value="hidden">不显示</option>';
						moduleAttrHtml += '<option selected value="normal">正常显示</option>';
						moduleAttrHtml += '<option  value="point">只显示刻度标记</option>';
					}else if('point'==attrValue){
						moduleAttrHtml += '<option  value="hidden">不显示</option>';
						moduleAttrHtml += '<option  value="normal">正常显示</option>';
						moduleAttrHtml += '<option selected value="point">只显示刻度标记</option>';
					}

					moduleAttrHtml += '</select>' +
						'</div>' +
						'</div>';
					showTypeXControl_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}




				if (attrType == 'hardwareInput') { //数据点绑定 文本框 点击弹框选择方式
					var attrValueTemp = "";
					try {
						attrValueTemp = eval(attrValue);
					} catch (e) {
						attrValueTemp = eval("[" + attrValue + "]");
					}
					var key = attrValueTemp[0].key;
					var name = attrValueTemp[0].name;
					if(!moduleObject.attrs.dataSourceType || moduleObject.attrs.dataSourceType=="liveData" || (moduleObject.attrs.dataSourceType=="platform" && moduleObject.attrs.dataAPIType=="/api/sensor/analysis")){
						moduleAttrHtml += '<div class="layui-form-item"  id="sensorBindItem">';
					}else{
						moduleAttrHtml += '<div class="layui-form-item"  id="sensorBindItem" style="display:none;">';
					}
                    //'<label class="layui-form-label">' + attrName + '</label>' +
					//'<label class="layui-form-label">'+attrName+'</label>' //写死为绑定数据点(4月8日改)
					moduleAttrHtml +='<label class="layui-form-label">绑定数据点</label>' +
						'<div class="layui-input-block" style="line-height:36px;">' +
						//'<input id="' + attrCode + '_' + attrWhere +
						//'_input_text" readOnly=readOnly type="text" lay-verify="" value="' + (key == '' ? '' :
						//	name + '-' + key) +
						//'" autocomplete="off" placeholder="点击选择"  style="float:left;width: 128px;" class="layui-input">' +
						//去ID
						// '<input id="' + attrCode + '_' + attrWhere + '_input_text" name="' + key + '" readOnly=readOnly type="text" lay-verify="borderSize" value="' + (key == '' ? '' : name) + '" autocomplete="off" placeholder="点击选择"  style="cursor:pointer" class="layui-input">' +
						// '<input type = "button" id="' + attrCode + '_' + attrWhere +
						// '_input_button" value="选择" class="layui-btn layui-btn-sm" style="padding: 0 10px; margin-left: 5px;"></input>' +
						// '</div>' +
						// '</div>';
						//2022年5月6日将点击按钮触发改为点击输入框触发,与5262行对应
						'<input id="' + attrCode + '_' + attrWhere + '_input_text" name="' + key +
						'" readOnly=readOnly type="text" lay-verify="borderSize" value="' + (key == '' ? '' :
							name) +
						'" autocomplete="off" placeholder="点击选择"  style="cursor:pointer" class="layui-input">' +
						//'<input type = "button" id="' + attrCode + '_' + attrWhere +
						//'_input_button" value="选择" class="layui-btn layui-btn-sm" style="padding: 0 10px; margin-left: 5px;"></input>' +
						'</div>' +
						'</div>';

					hardware_input_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}

				if (attrType == 'jumpInput') { //画面跳转
					var jumpValueTemp = eval("(" + attrValue + ")");
					var targetName = jumpValueTemp.targetName;
					var targetCode = jumpValueTemp.targetCode;
					moduleAttrHtml +=
						'<div class="layui-form-item">' +
						'<label class="layui-form-label">' + attrName + '</label>' +
						'<div class="layui-input-block">' +
						'<input id="' + attrCode + '_' + attrWhere.split(",")[0] +
						'_input_text" readOnly=readOnly type="text" lay-verify="borderSize" value="' + (
							targetCode == '' ? '' : targetName + '-' + targetCode) +
						'" autocomplete="off" placeholder="选择要跳转到的画面"  style="cursor:pointer" class="layui-input">' +
						'</div>' +
						'</div>';

					jump_input_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere
					});

				}


				if (attrType == 'whereSelectTable') { //水流动画条件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					where_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'whereStatusTable') { //状态条件

					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					whereStatus_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'whereStatusLightTable') { //状态条件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					whereStatusLight_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'ON_OFFSTATETable') { //开合状态
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					ON_OFFSTATET_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}

				if (attrType == 'whereStatusSwitchTable') { //状态条件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					whereStatusSwitch_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}

				if (attrType == 'valueZoomTable') { //值缩放
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					valueZoomConfig_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}

				if (attrType == 'imagesStatusTable') { //状态图片
					let sourceType = moduleObject.attrs.dataSourceType || "liveData";
					if(sourceType=="liveData"){
						moduleAttrHtml += '<div id="imagesStatusItem"><table class="layui-hide"  lay-filter="' + attrType + '"  id="' +
							attrType + '"></table></div>';
					}else if(sourceType=="platform" && moduleType=="IMAGES_STATUS"){
						moduleAttrHtml += '<div id="imagesStatusItem"><table class="layui-hide"  lay-filter="' + attrType + '"  id="' +
							attrType + '"></table></div>';
					}else{
						moduleAttrHtml += '<div id="imagesStatusItem" style="display:none;"><table class="layui-hide"    lay-filter="' + attrType + '"  id="' +
							attrType + '"></table></div>';
					}
					imagesStatusTable_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'clickTable') { //点击事件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					click_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'signalsTable') { //脉冲信号配置
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					clickMcxh_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'rotateTable') { //旋转条件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					rotate_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'rotateTableNew') { //旋转条件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					rotate_array_new.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'hideTable') { //隐藏条件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					hide_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'sparklingTable') { //闪烁条件
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					sparkling_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'DataKeyArrayTable') { //绑定多个数据点的表格
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					dataKeyArrayTable_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}
				if (attrType == 'DataKeyArrayTwo') { //绑定多个数据点的表格
					moduleAttrHtml += '<table class="layui-hide" lay-filter="' + attrType + '"  id="' +
						attrType + '"></table>';
					dataKeyArrayTable_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
					dataKeyArrayTable_array.push({
						attrCode: attrCode,
						attrValue: attrValue,
						attrWhere: attrWhere,
						attrType: attrType,
						attrName: attrName
					});
				}



			}






			$("#zjsx").html(moduleAttrHtml);
			//添加tips
			$('.butTips_attr').hover(function() {
				$('#byzttip').attr("class", "top_byzttip");
				var title = $(this).attr('data-title');
				$('#byzttip em').text(title);
				var pos = $(this).offset().left;
				var top = $(this).offset().top - $(this).outerHeight() - 5;
				var dis = ($('#byzttip').outerWidth() - $(this).outerWidth()) / 2;
				var l = pos - dis;

				$('#byzttip').css({
					'left': l + 'px'
				}).css({
					'top': top + 'px'
				}).show();
			}, function() {
				$('#byzttip').hide();
			});

			layui.form.render('select', 'zjsx');

			//初始化组件的一些选择效果，如颜色面板，进度条,滑块等。-----------------------------------------------------
			//初始化颜色面板
			for (var j = 0; j < color_array.length; j++) {
				var color_attr_id = color_array[j].attrCode + '_' + color_array[j].attrWhere.split(",")[0];
				var color_attr = color_array[j].attrCode;
				var color_attr_value = color_array[j].attrValue;
				var color_attr_Where = color_array[j].attrWhere;
				(function(color_attr_id, color_attr, color_attr_value, color_attr_Where) {

					colorpicker.render({
						elem: '#' + color_attr_id + '_ico_color',
						color: color_attr_value,
						predefine: true,
						change: function(color) {
							$('#' + color_attr_id + '_input_color').val(color);
							//将组件的选择后的值设置回组件
							stageOper.setModuleAttr(moduleObject, color_attr_Where, color_attr,
								color);

						},
						done: function(color) {
							$('#' + color_attr_id + '_input_color').val(color);
							stageOper.setModuleAttr(moduleObject, color_attr_Where, color_attr,
								color);
						}
					});

				})(color_attr_id, color_attr, color_attr_value, color_attr_Where);


			}
			//初始化按钮背景颜色面板
			for (var j = 0; j < buttonBackgroundColor_array.length; j++) {
				var button_color_attr_id = buttonBackgroundColor_array[j].attrCode + '_' +
					buttonBackgroundColor_array[j].attrWhere.split(",")[0];
				var button_color_attr = buttonBackgroundColor_array[j].attrCode;
				var button_color_attr_value = buttonBackgroundColor_array[j].attrValue;
				var button_color_attr_Where = buttonBackgroundColor_array[j].attrWhere;
				(function(button_color_attr_id, button_color_attr, button_color_attr_value,
					button_color_attr_Where) {

					colorpicker.render({
						elem: '#' + button_color_attr_id + '_ico_color',
						color: button_color_attr_value[1],
						predefine: true,
						change: function(color) {
							$('#' + button_color_attr_id + '_input_color').val(color);
							//将组件的选择后的值设置回组件
							button_color_attr_value[1] = color;
							button_color_attr_value[5] = color;
							stageOper.setModuleAttr(moduleObject, button_color_attr_Where,
								button_color_attr, button_color_attr_value);

						}
					});

				})(button_color_attr_id, button_color_attr, button_color_attr_value, button_color_attr_Where);


			}


			//初始化文本框，需要给文本框加监听
			for (var j = 0; j < input_text_array.length; j++) {
				var text_attr_id = input_text_array[j].attrCode + '_' + input_text_array[j].attrWhere.split(
					",")[0];
				var text_attr = input_text_array[j].attrCode;
				var text_attr_value = input_text_array[j].attrValue;
				var text_attr_Where = input_text_array[j].attrWhere;
				//用户输入的内容改变时触发，相当于实时监听
				(function(text_attr_id, text_attr, text_attr_value, text_attr_Where) {
					$('#' + text_attr_id + '_input_text').on('input', function() {
						var input_value = $(this).val();
						if ("." == (input_value.substr(input_value.length - 1, 1))) {
							return;
						}
						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (text_attr == "strokeWidth" || text_attr == "poolHight" || text_attr ==
							"cornerRadius" || text_attr == "angle" || text_attr == "innerRadius" ||
							text_attr == "outerRadius" ||
							text_attr == "numPoints" || text_attr == "sides" || text_attr ==
							"radius" || text_attr == "pointerLength" || text_attr ==
							"pointerWidth" || text_attr == "historyCount" ||
							text_attr == "lineHeight" || text_attr == "padding" || text_attr ==
							"cellWidth" || text_attr == "cellHeight" || text_attr == "rowNum" ||
							text_attr == "colNum" || text_attr == "labelWidth" || text_attr == "valueWidth"
						) {
							if (!isNumber || input_value == "") {
								$(this).val("");
								return;
							}
							if (isNumber) {
								if (input_value < 0) {
									$(this).val("");
									return;
								}
							}

						}
						stageOper.setModuleAttr(moduleObject, text_attr_Where, text_attr,
							input_value);
					});
				})(text_attr_id, text_attr, text_attr_value, text_attr_Where);
			}

			//旋转图片添加监听
			for (var j = 0; j < rotatImage_array.length; j++) {
				var rotatImage_attr_id = rotatImage_array[j].attrCode + '_' + rotatImage_array[j].attrWhere
					.split(",")[0];
				var rotatImage_attr = rotatImage_array[j].attrCode;
				var rotatImage_attr_value = rotatImage_array[j].attrValue;
				var rotatImage_attr_Where = rotatImage_array[j].attrWhere;
				//用户输入的内容改变时触发，相当于实时监听
				(function(rotatImage_attr_id, rotatImage_attr, rotatImage_attr_value, rotatImage_attr_Where) {
					$('#' + rotatImage_attr_id + '_image').click(function(e) {
						var imgElem = $(this);
						layer.open({
							title: '请选择图片',
							type: 2,
							area: ['600px', '300px'],
              skin: 'layer-class',
							fixed: false, //不固定
							maxmin: true,
							content: 'imageRotatList.html',
							end: function(index, layero) {
								if (imageStatusUrl !== '') {
									imgElem.attr('src', imageStatusUrl);
									stageOper.setModuleAttr(moduleObject,
										rotatImage_attr_Where, rotatImage_attr,
										imageStatusUrl);
									imageStatusUrl = '';
								}

							}

						});
					});
				})(rotatImage_attr_id, rotatImage_attr, rotatImage_attr_value, rotatImage_attr_Where);
			}

      //按钮背景图片添加监听
      for (var j = 0; j < buttonImage_array.length; j++) {
      	var buttonImage_attr_id = buttonImage_array[j].attrCode + '_' + buttonImage_array[j].attrWhere
      		.split(",")[0];
      	var buttonImage_attr = buttonImage_array[j].attrCode;
      	var buttonImage_attr_value = buttonImage_array[j].attrValue;
      	var buttonImage_attr_Where = buttonImage_array[j].attrWhere;
      	//用户输入的内容改变时触发，相当于实时监听
      	(function(buttonImage_attr_id, buttonImage_attr, buttonImage_attr_value, buttonImage_attr_Where) {
      		$('#' + buttonImage_attr_id + '_image').click(function(e) {
      			var imgElem = $(this);
      			layer.open({
      				title: '请选择图片',
      				type: 2,
      				area: ['600px', '400px'],
              skin: 'layer-class',
      				fixed: false, //不固定
      				maxmin: true,
      				content: 'imageButtonList.html',
      				end: function(index, layero) {
      					if (imageStatusUrl !== '') {
      						imgElem.attr('src', imageStatusUrl);
      						moduleObject.attrs.btnImageUrl=imageStatusUrl;
      						stageOper.setModuleAttr(moduleObject,
      							buttonImage_attr_Where, buttonImage_attr,
      							imageStatusUrl);
      						imageStatusUrl = '';
      					}

      				}

      			});
      		});
      	})(buttonImage_attr_id, buttonImage_attr, buttonImage_attr_value, buttonImage_attr_Where);
      }


			//初始化文本域，需要给文本域加监听
			for (var j = 0; j < textarea_text_array.length; j++) {
				var textarea_attr_id = textarea_text_array[j].attrCode + '_' + textarea_text_array[j].attrWhere
					.split(",")[0];
				var textarea_attr = textarea_text_array[j].attrCode;
				var textarea_attr_value = textarea_text_array[j].attrValue;
				var textarea_attr_Where = textarea_text_array[j].attrWhere;
				//用户输入的内容改变时触发，相当于实时监听
				(function(textarea_attr_id, textarea_attr, textarea_attr_value, textarea_attr_Where) {
					$('#' + textarea_attr_id + '_textarea_text').on('input', function() {
						var input_value = $(this).val();

						stageOper.setModuleAttr(moduleObject, textarea_attr_Where, textarea_attr,
							input_value);
					});
				})(textarea_attr_id, textarea_attr, textarea_attr_value, textarea_attr_Where);
			}

			//给对齐添加监听
			for (var j = 0; j < align_array.length; j++) {
				var align_attr_name = align_array[j].attrCode + '_' + align_array[j].attrWhere.split(",")[0];
				var align_attr = align_array[j].attrCode;
				var align_value = align_array[j].attrValue;
				var align_Where = align_array[j].attrWhere;
				//用户输入的内容改变时触发，相当于实时监听
				(function(align_attr_name, align_attr, align_value, align_Where) {

					$("button[name='" + align_attr_name + "_align']").on('click', function() {
						var buttonAlignType = $(this).attr("alignTtype");
						var alignButtonGroup = $("button[name='" + align_attr_name + "_align']");
						for (var align_i = 0; align_i < alignButtonGroup.length; align_i++) {
							var alignButton = $(alignButtonGroup[align_i]);
							if (alignButton.is($(this))) {
								alignButton.attr("class", "layui-btn  layui-btn-sm");
							} else {
								alignButton.attr("class",
									"layui-btn layui-btn-primary layui-btn-sm");
							}

						}



						// alert(buttonAlignType);
						stageOper.setModuleAttr(moduleObject, align_Where, align_attr,
							buttonAlignType);
					});
				})(align_attr_name, align_attr, align_value, align_Where);
			}

			//初始化密码文本框，需要给文本框加监听
			for (var j = 0; j < inputPwd_text_array.length; j++) {
				var text_attr_id = inputPwd_text_array[j].attrCode + '_' + inputPwd_text_array[j].attrWhere;
				var text_attr = inputPwd_text_array[j].attrCode;
				var text_attr_value = inputPwd_text_array[j].attrValue;
				var text_attr_Where = inputPwd_text_array[j].attrWhere;
				//用户输入的内容改变时触发，相当于实时监听
				(function(text_attr_id, text_attr, text_attr_value, text_attr_Where) {
					$('#' + text_attr_id + '_inputPwd_text').on('input', function() {
						var input_value = $(this).val();
						stageOper.setModuleAttr(moduleObject, text_attr_Where, text_attr,
							input_value);
					});
				})(text_attr_id, text_attr, text_attr_value, text_attr_Where);
			}







			//初始化滑块 透明度
			for (var j = 0; j < slider_array.length; j++) {
				var slider_attr_id = slider_array[j].attrCode;
				var slider_attr_value = slider_array[j].attrValue;
				var slider_attr_Where = slider_array[j].attrWhere;
				//用户输入的内容改变时触发，相当于实时监听
				(function(slider_attr_id, slider_attr_value, slider_attr_Where) {
					slider.render({
						elem: '#' + slider_attr_id + '_slider',
						value: slider_attr_value * 100,
						input: true //输入框
							,
						change: function(value) {
							stageOper.setModuleAttr(moduleObject, slider_attr_Where,
								slider_attr_id, value / 100);
						}
					});
				})(slider_attr_id, slider_attr_value, slider_attr_Where);
			}
			//初始化滑块 旋转速度
			for (var j = 0; j < speedSlider_array.length; j++) {
				var speedSlider_attr_id = speedSlider_array[j].attrCode;
				var speedSlider_attr_value = speedSlider_array[j].attrValue;
				var speedSlider_attr_Where = speedSlider_array[j].attrWhere;
				//用户输入的内容改变时触发，相当于实时监听
				(function(speedSlider_attr_id, speedSlider_attr_value, speedSlider_attr_Where) {
					slider.render({
						elem: '#' + speedSlider_attr_id + '_speedSlider',
						value: speedSlider_attr_value,
						min: 0,
						max: 10,
						input: true //输入框
							,
						change: function(value) {
							stageOper.setModuleAttr(moduleObject, speedSlider_attr_Where,
								speedSlider_attr_id, value);
						}
					});
				})(speedSlider_attr_id, speedSlider_attr_value, speedSlider_attr_Where);
			}

			//给基础信息展现方式添加监听
			for (var j = 0; j < basicInfo_array.length; j++) {

				var zxfs_attr_id = basicInfo_array[j].attrCode;
				var zxfs_attr_value = basicInfo_array[j].attrValue.showType; //展现方式的值
				var zxfsContent_attr_value = basicInfo_array[j].attrValue.showContent.length?basicInfo_array[j].attrValue.showContent:[{
								title: "",
								type: 1,
								value: ""
							}]; //展现内容的值
				var closeViewType =basicInfo_array[j].attrValue.closeViewType || '0'; //值类型为图纸时的关闭方式
				var zxfs_attr_Where = basicInfo_array[j].attrWhere;
				var zxfs_attr_Type = basicInfo_array[j].attrType;
				var zxfs_attr_Name = basicInfo_array[j].attrName;
				//展现方式处理
				(function(zxfs_attr_id, zxfs_attr_value, zxfs_attr_Where) {
					layui.form.on('select(select_zxfs)', function(data) {
						var zxfsValue = data.value;
						stageOper.setModuleAttr(moduleObject, zxfs_attr_Where, zxfs_attr_id,
							zxfsValue, 'zxfs');

					});
				})(zxfs_attr_id, zxfs_attr_value, zxfs_attr_Where);


				//值类型为图纸时的关闭方式处理
				(function(zxfs_attr_id, closeViewType, zxfs_attr_Where) {
					layui.form.on('select(select_closeType)', function(data) {
						var typeValue = data.value;
						stageOper.setModuleAttr(moduleObject, zxfs_attr_Where, zxfs_attr_id,
							typeValue, 'closeType');
				    });
				})(zxfs_attr_id, closeViewType, zxfs_attr_Where);


				//展现内容处理
				(function(zxfs_attr_id, zxfsContent_attr_value, zxfs_attr_Where, zxfs_attr_Type,
					zxfs_attr_Name) {

                    var nowDraws = new Array();  //当前图纸数组
                    var hasDraw = false;   //原值类型是否为图纸
                    var oldValue = '';  //原来的值，只用于值类型为图纸
					var table_data = new Array();;
					for (var i = 0; i < zxfsContent_attr_value.length; i++) {
						var whereObj_t = zxfsContent_attr_value[i];
						var obj_t = {};
						obj_t.title = whereObj_t.title;
						obj_t.type = whereObj_t.type;
						obj_t.value = whereObj_t.value;
						table_data.push(obj_t);
						if(obj_t.type==5){
							$("#closeViewType").css("display","block");
						    nowDraws = eval("initConfig.getDrawsMoudleData(" + localStorage.getItem(
								'editViewId') + ")");
							console.log(nowDraws);
							hasDraw = true;
							oldValue = obj_t.value;
							break;
						}else{
							$("#closeViewType").css("display","none");
						}

					}


					table.render({
						elem: '#' + zxfs_attr_Type,
						toolbar: '<div style="float: left">展现内容<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [
						//暂时支持单个，不再添加
						// 	{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
						// 	title: '添加条件',
						// 	layEvent: 'addWhere',
						// 	icon: 'layui-icon-add-1'
						// },
						{
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[

								{
									field: 'title',
									align: 'center',
									width: 76,
									title: '标题',
									edit: 'text'
								}, {
									field: 'type',
									align: 'center',
									width: 70,
									title: '值类型',
									templet: '#valueType'
								}, {
									field: 'value',
									align: 'center',
									width: 80,
									title: '值',
									templet: '#value_basicInfo_Select'
								}, {
									title: '操作',
									align: 'center',
									width: 56,
									toolbar: '#wherebar'
								}
							]
						],
						done: function(res, curr, count) {
							//绑定数据点监听
							$("input[name='device_basicInfo_Select_select']").bind("click",
								function() {
									var current_input = $(this);
									var input_value = $(this).val(); // 当前文本框的值
									//测试操作代码
									//alert($(this).val());
									var $selectedvalue = $(this).val();
									layer.open({
										title: '请选择需要绑定的数据点<span style="color:#ff0000">(已过滤空设备和空分组)</span>',
										type: 2,
										// area: ['1000px', '600px'],
                    area: ['820px', '700px'],
                    skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'hardwareSelect.html?hardware_id=' +
											input_value,
										end: function(index, layero) {
											//   var hardware_id="";//当前选择的硬件传感器数据点的id
											//    var hardware_Text="";//当前选择的硬件传感器数据点的描述

											if (hardware_id !== '') {
												// current_input.val(
												// 	hardware_Text + "-" +
												// 	hardware_id);
												current_input.val(
													hardware_Text);
												var selectElem = current_input;
												var tdElem = selectElem.closest(
													"td");
												var trElem = tdElem.closest(
													"tr");
												var tableView = trElem.closest(
													".layui-table-view");
												var jyzt_lay_id = tableView
													.attr(
														"lay-id"); //layui表格的id
												table.cache[tableView.attr(
													"lay-id")][trElem.data(
													"index")]['value'] = {
													devicecode: hardware_id,
													devicename: hardware_Text
												};

												stageOper.setModuleAttr(
													moduleObject,
													zxfs_attr_Where,
													zxfs_attr_id, table
													.cache[tableView.attr(
														"lay-id")], 'zxnr');

												hardware_id = "";
												hardware_Text = "";
											}

										}

									});

								});

							if(hasDraw)	{
								//var selectDrawsHtml=  "<option value=''>请选择</option>";
								var selectDrawsHtml=  "";
								if(nowDraws.length){
									$.each(nowDraws, function(k, draw) {
										var selectStr=draw.id==oldValue?'selected':k==0?'selected':'';
										selectDrawsHtml += "<option value='" + draw.id + "' " + selectStr +
											">" + draw.draw_name + "</option>";
									});
								}
								$("#viewBasicInfoSelect").html(selectDrawsHtml);
								form.render();

							}

							//值类型监听
							form.on('select(infoClickType_select)', function(data) {
								var selectElem = $(data.elem);
								var tdElem = selectElem.closest("td");
								var trElem = tdElem.closest("tr");
								var tableView = trElem.closest(".layui-table-view");
								var jyzt_lay_id = tableView.attr("lay-id"); //layui表格的id

								if (table.cache[tableView.attr("lay-id")][trElem.data(
										"index")]['type'] == data
									.value) { // 原来 的值 和当前选择的值一样的话 什么都不做
									return;
								}

								table.cache[tableView.attr("lay-id")][trElem.data(
									"index")]['type'] = data.value;
								if(data.value!='5')	{
									$("#closeViewType").css("display","none");
									table.cache[tableView.attr("lay-id")][trElem.data(
										"index")]['value'] = "";
								}
								table.reload(jyzt_lay_id);
								if(data.value=='5'){
									$("#closeViewType").css("display","block");
									if(!nowDraws.length){
										nowDraws = eval("initConfig.getDrawsMoudleData(" + localStorage.getItem(
											'editViewId') + ")");
									   // var selectDrawsHtml=  "<option value=''>请选择</option>";
										var selectDrawsHtml=  "";
										$.each(nowDraws, function(k, draw) {
										    var selectStr=draw.id==oldValue?'selected':k==0?'selected':'';
											selectDrawsHtml += "<option value='" + draw.id + "' " + selectStr +
												">" + draw.draw_name + "</option>";
										});
										$("#viewBasicInfoSelect").html(selectDrawsHtml);
										form.render();
									}
									if(nowDraws.length){
										if(oldValue){
											table.cache[tableView.attr("lay-id")][trElem.data("index")]['value']=oldValue;
										}else{
										    table.cache[tableView.attr("lay-id")][trElem.data("index")]['value']=nowDraws[0].id;
										}

								    }
								}

								stageOper.setModuleAttr(moduleObject, zxfs_attr_Where,
									zxfs_attr_id, table.cache[tableView.attr(
										"lay-id")], 'zxnr');

							});

							//值文本框监听
							$('input[name="infoValueInput"]').on('input', function() {
								var _this = $(this);
								var thisValue = _this.val();

								var selectElem = _this;
								var tdElem = selectElem.closest("td");
								var trElem = tdElem.closest("tr");
								var tableView = trElem.closest(".layui-table-view");
								var jyzt_lay_id = tableView.attr("lay-id"); //layui表格的id
								table.cache[tableView.attr("lay-id")][trElem.data(
									"index")]['value'] = thisValue;
								stageOper.setModuleAttr(moduleObject, zxfs_attr_Where,
									zxfs_attr_id, table.cache[tableView.attr(
										"lay-id")], 'zxnr');
							});


							//图纸值监听与配置
							form.on('select(view_basicInfo_Select_select)', function(data) {
								console.log(data.value);
								var _this = $(this);
								//var thisValue = data.value;
								var selectElem = _this;
								var tdElem = selectElem.closest("td");
								var trElem = tdElem.closest("tr");
								var tableView = trElem.closest(".layui-table-view");
								var jyzt_lay_id = tableView.attr("lay-id"); //layui表格的id
								table.cache[tableView.attr("lay-id")][trElem.data(
									"index")]['value'] = data.value;
								stageOper.setModuleAttr(moduleObject, zxfs_attr_Where,
									zxfs_attr_id, table.cache[tableView.attr(
										"lay-id")], 'zxnr');
							})

							//状态值配置
							$("input[name='state_basicInfo_Select_select']").bind("click",
								function() {
									var current_input = $(this);
									var selectElem = current_input;
									var tdElem = selectElem.closest("td");
									var trElem = tdElem.closest("tr");
									var tableView = trElem.closest(".layui-table-view");
									var jyzt_lay_id = tableView.attr("lay-id"); //layui表格的id
									var stateConfig = table.cache[tableView.attr("lay-id")][
										trElem.data("index")
									]['value'];
									basicStateConfig = stateConfig;
									layer.open({
										title: '请配置状态值对应的文字',
										type: 2,
										area: ['600px', '510px'],
                    skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'basicStateConfig.html',
										end: function(index, layero) {
											//   var hardware_id="";//当前选择的硬件传感器数据点的id
											//    var hardware_Text="";//当前选择的硬件传感器数据点的描述

											if (JSON.stringify(
													basicStateConfig) != "{}") {

												var selectElem = current_input;
												var tdElem = selectElem.closest(
													"td");
												var trElem = tdElem.closest(
													"tr");
												var tableView = trElem.closest(
													".layui-table-view");
												var jyzt_lay_id = tableView
													.attr(
														"lay-id"); //layui表格的id
												table.cache[tableView.attr(
														"lay-id")][trElem.data(
														"index")]['value'] =
													basicStateConfig;
												stageOper.setModuleAttr(
													moduleObject,
													zxfs_attr_Where,
													zxfs_attr_id, table
													.cache[tableView.attr(
														"lay-id")], 'zxnr');
												table.reload(jyzt_lay_id);

											}

										}

									});

								});



						}
					});


					//头工具栏事件
					table.on('toolbar(' + zxfs_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"title": "",
									"type": "1",
									"value": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + zxfs_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject, zxfs_attr_Where,
										zxfs_attr_id, table.cache[tableView.attr(
											"lay-id")], 'zxnr');

								}
								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + zxfs_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, zxfs_attr_Where, zxfs_attr_id, table
							.cache[tableView.attr("lay-id")], 'zxnr');
					});


				})(zxfs_attr_id, zxfsContent_attr_value, zxfs_attr_Where, zxfs_attr_Type, zxfs_attr_Name);




			}
			//给组件位置添加监听
			for (var j = 0; j < position_array.length; j++) {
				var position_attr_Where = position_array[j].attrWhere;

				(function(position_attr_Where) {
					//给X添加监听
					$('#module_' + position_attr_Where.split(",")[0] + '_x').on('input', function() {
						var input_value = $(this).val();
						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (!isNumber || input_value == "") {
							//$(this).val("");
							return;
						}
						if (isNumber) {
							if (input_value < 0) {
								//$(this).val("");
								return;
							}
						}
						stageOper.setModuleAttr(moduleObject, position_attr_Where, 'x',
							input_value);
					});
					//给y添加监听
					$('#module_' + position_attr_Where.split(",")[0] + '_y').on('input', function() {
						var input_value = $(this).val();
						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (!isNumber || input_value == "") {
							//$(this).val("");
							return;
						}
						if (isNumber) {
							if (input_value < 0) {
								//$(this).val("");
								return;
							}
						}
						stageOper.setModuleAttr(moduleObject, position_attr_Where, 'y',
							input_value);
					});

					//给大小X添加监听
					$('#module_' + position_attr_Where.split(",")[0] + '_scalex').on('input', function() {
						var input_value = $(this).val();
						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (!isNumber || input_value == "") {
							//$(this).val("");
							return;
						}
						if (isNumber) {
							if (input_value <= 0) {
								//$(this).val("");
								return;
							}
						}
						stageOper.setModuleAttr(moduleObject, position_attr_Where, 'scale', {
							x: input_value,
							y: $('#module_' + position_attr_Where.split(",")[0] + '_scaley')
								.val()
						});
					});
					//给大小y添加监听
					$('#module_' + position_attr_Where.split(",")[0] + '_scaley').on('input', function() {
						var input_value = $(this).val();
						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (!isNumber || input_value == "") {
							//$(this).val("");
							return;
						}
						if (isNumber) {
							if (input_value <= 0) {
								//$(this).val("");
								return;
							}
						}
						stageOper.setModuleAttr(moduleObject, position_attr_Where, 'scale', {
							x: $('#module_' + position_attr_Where.split(",")[0] + '_scalex')
								.val(),
							y: input_value
						});
					});





				})(position_attr_Where);


			}
			//给鼠标点击弹框添加监听
			for (var j = 0; j < ClickInfo_array.length; j++) {

				var ClickInfo_attr_id = ClickInfo_array[j].attrCode;
				var ClickInfo_attr_Where = ClickInfo_array[j].attrWhere;
				var ClickInfo_attr_value = ClickInfo_array[j].attrValue.clickType; //是否启用点击

				var ClickInfo_attr_Type = ClickInfo_array[j].attrType;
				var ClickInfo_attr_Name = ClickInfo_array[j].attrName;




				(function(ClickInfo_attr_id, ClickInfo_attr_value, ClickInfo_attr_Where) {
					//是否启用
					layui.form.on('select(select_clickSfqy)', function(data) {
						var sfqyValue = data.value;
						stageOper.setModuleAttr(moduleObject, ClickInfo_attr_Where,
							ClickInfo_attr_id, sfqyValue, 'clickType');

					});
					//url
					$('#module_' + ClickInfo_attr_Where.split(",")[0] + '_URL').on('input', function() {
						var input_value = $(this).val();
						stageOper.setModuleAttr(moduleObject, ClickInfo_attr_Where,
							ClickInfo_attr_id, input_value, 'urlContent');
					});
					//宽
					$('#module_' + ClickInfo_attr_Where.split(",")[0] + '_width').on('input', function() {
						var input_value = $(this).val();

						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (!isNumber || input_value == "") {
							//$(this).val("");
							return;
						}
						if (isNumber) {
							if (input_value <= 0) {
								//$(this).val("");
								return;
							}
						}
						stageOper.setModuleAttr(moduleObject, ClickInfo_attr_Where,
							ClickInfo_attr_id, input_value, 'contentWidth');
					});
					//高
					$('#module_' + ClickInfo_attr_Where.split(",")[0] + '_height').on('input', function() {
						var input_value = $(this).val();
						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (!isNumber || input_value == "") {
							//$(this).val("");
							return;
						}
						if (isNumber) {
							if (input_value <= 0) {
								//$(this).val("");
								return;
							}
						}
						stageOper.setModuleAttr(moduleObject, ClickInfo_attr_Where,
							ClickInfo_attr_id, input_value, 'contentHeight');
					});





				})(ClickInfo_attr_id, ClickInfo_attr_value, ClickInfo_attr_Where);






			}

			//给边框添加监听
			for (var j = 0; j < border_array.length; j++) {
				var border_attr_Where = border_array[j].attrWhere;

				(function(border_attr_Where) {

					//给字颜色添加监听
					var moudleShape = moduleObject.findOne('.' + border_attr_Where.split(",")[0]);
					var stroke = moudleShape.getAttr("stroke");
					colorpicker.render({
						elem: '#border_' + border_attr_Where.split(",")[0] + '_ico_color',
						color: stroke,
						predefine: true,
						change: function(color) {
							//将组件的选择后的值设置回组件
							stageOper.setModuleAttr(moduleObject, border_attr_Where, 'stroke',
								color);
						},
						done: function(color) {
							stageOper.setModuleAttr(moduleObject, border_attr_Where, 'stroke',
								color);
						}
					});
					//给边框粗细添加监听
					$('#border_' + border_attr_Where.split(",")[0] + '_size').on('input', function() {
						var input_value = $(this).val();
						var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
						if (!isNumber || input_value == "") {
							$(this).val("");
							return;
						}
						if (isNumber) {
							if (input_value < 0) {
								$(this).val("");
								return;
							}
						}
						stageOper.setModuleAttr(moduleObject, border_attr_Where, 'strokeWidth',
							input_value);
					});
					//给边框圆角添加监听
					$('#border_' + border_attr_Where.split(",")[0] + '_cornerRadius').on('input',
						function() {
							var input_value = $(this).val();
							var isNumber = stageOper.isNumber(input_value); //下面这些属性必须是数字，如果不是，清空文本框
							if (!isNumber || input_value == "") {
								$(this).val("");
								return;
							}
							if (isNumber) {
								if (input_value < 0) {
									$(this).val("");
									return;
								}
							}
							stageOper.setModuleAttr(moduleObject, border_attr_Where, 'cornerRadius',
								input_value);
						});



				})(border_attr_Where);


			}
			//给字体，字好，颜色添加监听
			for (var j = 0; j < font_array_new.length; j++) {
				var fontNew_attr_Where = font_array_new[j].attrWhere;

				(function(fontNew_attr_Where) {
					layui.form.on('select(select_font_' + fontNew_attr_Where.split(",")[0] + '_new)',
						function(data) {
							var fontValue = data.value;
							stageOper.setModuleAttr(moduleObject, fontNew_attr_Where, "fontFamily",
								fontValue);

						});
					//给字号添加监听
					layui.form.on('select(selectNew_' + fontNew_attr_Where.split(",")[0] + '_fontSize)',
						function(data) {
							var fontSizeValue = data.value;
							stageOper.setModuleAttr(moduleObject, fontNew_attr_Where, "fontSize",
								fontSizeValue);

						});
					//给字颜色添加监听
					var moudleShape = moduleObject.findOne('.' + fontNew_attr_Where.split(",")[0]);
					var fontColor = moudleShape.getAttr("fill");
					colorpicker.render({
						elem: '#fillNew_' + fontNew_attr_Where.split(",")[0] + '_ico_color',
						color: fontColor,
						predefine: true,
						change: function(color) {
							$('#fillNew_' + fontNew_attr_Where.split(",")[0] + '_input_color')
								.val(color);
							//将组件的选择后的值设置回组件
							stageOper.setModuleAttr(moduleObject, fontNew_attr_Where, 'fill',
								color);

						}
					});
					//给字体类型添加监听，正常，粗体，斜体
					$("button[name='" + fontNew_attr_Where.split(",")[0] + "_fontStyle']").on('click',
						function() {
							var buttonFontStyle = $(this).attr("fontStyle");
							var fontStyleButtonGroup = $("button[name='" + fontNew_attr_Where.split(
								",")[0] + "_fontStyle']");
							for (var style_i = 0; style_i < fontStyleButtonGroup.length; style_i++) {
								var styleButton = $(fontStyleButtonGroup[style_i]);
								if (styleButton.is($(this))) {
									styleButton.attr("class", "layui-btn  layui-btn-sm");
								} else {
									styleButton.attr("class",
										"layui-btn layui-btn-primary layui-btn-sm");
								}

							}
							// alert(buttonAlignType);
							stageOper.setModuleAttr(moduleObject, fontNew_attr_Where, "fontStyle",
								buttonFontStyle);
						});
				})(fontNew_attr_Where);
			}

			//给字体添加监听
			for (var j = 0; j < font_array.length; j++) {
				var font_attr_id = font_array[j].attrCode;
				var font_attr_value = font_array[j].attrValue;
				var font_attr_Where = font_array[j].attrWhere;

				(function(font_attr_id, font_attr_value, font_attr_Where) {
					layui.form.on('select(select_font)', function(data) {
						var fontValue = data.value;
						stageOper.setModuleAttr(moduleObject, font_attr_Where, font_attr_id,
							fontValue);

					});
				})(font_attr_id, font_attr_value, font_attr_Where);
			}
			// 给当前时间添加监听
			for (var j = 0; j < dateFormat_array.length; j++) {
				var dateFormat_attr_id = dateFormat_array[j].attrCode;
				var dateFormat_attr_value = dateFormat_array[j].attrValue;
				var dateFormat_attr_Where = dateFormat_array[j].attrWhere;

				(function(dateFormat_attr_id, dateFormat_attr_value, dateFormat_attr_Where) {
					layui.form.on('select(select_dateFormat)', function(data) {
						var dateFormatValue = data.value;
						stageOper.setModuleAttr(moduleObject, dateFormat_attr_Where,
							dateFormat_attr_id, dateFormatValue);

					});
				})(dateFormat_attr_id, dateFormat_attr_value, dateFormat_attr_Where);
			}
			// 文字样式添加监听
			for (var j = 0; j < fontStyle_array.length; j++) {
				var fontStyle_attr_id = fontStyle_array[j].attrCode;
				var fontStyle_attr_value = fontStyle_array[j].attrValue;
				var fontStyle_attr_Where = fontStyle_array[j].attrWhere;

				(function(fontStyle_attr_id, fontStyle_attr_value, fontStyle_attr_Where) {
					layui.form.on('select(select_fontStyle)', function(data) {
						var fontStyleValue = data.value;
						stageOper.setModuleAttr(moduleObject, fontStyle_attr_Where,
							fontStyle_attr_id, fontStyleValue);

					});
				})(fontStyle_attr_id, fontStyle_attr_value, fontStyle_attr_Where);
			}





			//给字号添加监听
			for (var j = 0; j < fontSize_array.length; j++) {
				var fontSize_attr_id = fontSize_array[j].attrCode;
				var fontSize_attr_value = fontSize_array[j].attrValue;
				var fontSize_attr_Where = fontSize_array[j].attrWhere;

				(function(fontSize_attr_id, fontSize_attr_value, fontSize_attr_Where) {
					layui.form.on('select(select_fontSize)', function(data) {
						var fontSizeValue = data.value;
						stageOper.setModuleAttr(moduleObject, fontSize_attr_Where, fontSize_attr_id,
							fontSizeValue);

					});
				})(fontSize_attr_id, fontSize_attr_value, fontSize_attr_Where);
			}
			//给字绑定的硬件添加监听 废弃
			for (var j = 0; j < hardware_array.length; j++) {
				var hardware_attr_id = hardware_array[j].attrCode;
				var hardware_attr_value = hardware_array[j].attrValue;
				var hardware_attr_Where = hardware_array[j].attrWhere;

				(function(hardware_attr_id, hardware_attr_value, hardware_attr_Where) {
					layui.form.on('select(select_hardware)', function(data) {
						var hardValue = "['" + data.value + "']";

						stageOper.setModuleAttr(moduleObject, hardware_attr_Where, hardware_attr_id,
							hardValue);

					});
				})(hardware_attr_id, hardware_attr_value, hardware_attr_Where);
			}

			//给数据来源类型添加监听
			for (var j = 0; j < dataSourceControl_array.length; j++) {
				var dataSourceControl_attr_id = dataSourceControl_array[j].attrCode;
				var dataSourceControl_attr_value = dataSourceControl_array[j].attrValue;
				var dataSourceControl_attr_Where = dataSourceControl_array[j].attrWhere;

				(function(dataSourceControl_attr_id, dataSourceControl_attr_value, dataSourceControl_attr_Where) {

					layui.form.on('select(select_dataSourceControl)', function(data) {
						var selectValue = data.value;
						fieldsArray = [];
						if(data.value=='platform'){
							$("#dataAPIItem").css("display","block");
							$("#refreshTypeItem").css("display","block");
							$("#fieldItem").css("display","block");
							$("#sensorBindItem").css("display","none");
							if(moduleType=="IMAGES_STATUS"){
								$("#imagesStatusItem").css("display","none");
							}
							let totalArray = ["/api/index/counts","/api/alarm/counts","/api/equip/counts"];
							dataApiArray = eval("initConfig." + initjson.getDataAPIFunction + "()");
							if(['ECHART_realTimeBarGraph','ECHART_realTimeSortBar','ECHART_realTimePieGraph','ECHART_realTimeCircularGraph'].indexOf(moduleType)<0){
								dataApiArray.pop();  //末尾删除，删除变量数据分析
								if(totalArray.indexOf(dataApiArray[0].value)>=0){
								    $("#totalAreaItem").css("display","block");
								}else{
									$("#totalAreaItem").css("display","none");
								}
								$("#dateTypeItem").css("display","none");
								$("#functionItem").css("display","none");
							}else{
								dataApiArray.splice(0,4);   //只保留数据分析
								$("#dateTypeItem").css("display","block");
								$("#functionItem").css("display","block");
								$("#totalAreaItem").css("display","none");
							}
							let moduleAttrHtml = '<option selected  value='+dataApiArray[0].value+'>'+dataApiArray[0].label+'</option>';
							for(let i=1,len=dataApiArray.length;i<len;i++){
								moduleAttrHtml += '<option value='+dataApiArray[i].value+'>'+dataApiArray[i].label+'</option>';
							}
							$("#dataAPIControl").html(moduleAttrHtml);
							fieldsArrayAll = Array.from(dataApiArray[0].fields)
							fieldsArray = Array.from(dataApiArray[0].fields);
							//如果统计范围为当前项目，去掉项目总数这个选项
							if(totalArray.indexOf(dataApiArray[0].value)>=0 && moduleObject.attrs.totalArea=="thisOption"){
							    //如果统计范围为当前项目，去掉项目总数和用户总数这两个选项
							    fieldsArray = Array.from(fieldsArrayAll);
							    fieldsArray.shift();
							    fieldsArray.shift();
							}else{
								fieldsArray=fieldsArrayAll;
							}
							let fieldHtml = '<option selected  value='+fieldsArray[0].key+'>'+fieldsArray[0].label+'</option>';
							for(let t=1,len=fieldsArray.length;t<len;t++){
								fieldHtml += '<option value='+fieldsArray[t].key+'>'+fieldsArray[t].label+'</option>';
							}
							$("#fieldControl").html(fieldHtml);
							layui.form.render("select");
							//moduleObject.attrs.field = fieldsArray[0].key;
							stageOper.setModuleAttr(moduleObject, "this",
							"dataAPIType", dataApiArray[0].value);
							stageOper.setModuleAttr(moduleObject, "this",
							"field", fieldsArray[0].key);
							//console.log(dataApiControl_array);
						}else{
							$("#sensorBindItem").css("display","block");
							$("#refreshTypeItem").css("display","none");
							if(moduleType=="IMAGES_STATUS"){
								$("#imagesStatusItem").css("display","block");
							}
							$("#dataAPIItem").css("display","none");
							$("#equipItem").css("display","none");
							$("#fieldItem").css("display","none");
							$("#dateTypeItem").css("display","none");
							$("#functionItem").css("display","none");
						}
						stageOper.setModuleAttr(moduleObject, dataSourceControl_attr_Where,
							dataSourceControl_attr_id, selectValue);

					});

				})(dataSourceControl_attr_id, dataSourceControl_attr_value, dataSourceControl_attr_Where);

			}

			//给数据类别添加监听
			for (var j = 0; j < dataApiControl_array.length; j++) {
				var dataApiControl_attr_id = dataApiControl_array[j].attrCode;
				var dataApiControl_attr_value = dataApiControl_array[j].attrValue;
				var dataApiControl_attr_Where = dataApiControl_array[j].attrWhere;

				(function(dataApiControl_attr_id, dataApiControl_attr_value, dataApiControl_attr_Where) {
					layui.form.on('select(select_dataAPIControl)', function(data) {
						var selectValue = data.value;
						fieldsArray = [];
						for(let i=0,len=dataApiArray.length;i<len;i++){
							if(dataApiArray[i].value==selectValue){
								fieldsArray=Array.from(dataApiArray[i].fields);
								fieldsArrayAll = Array.from(dataApiArray[i].fields);
								let totalArray = ["/api/index/counts","/api/alarm/counts","/api/equip/counts"];
								if(totalArray.indexOf(selectValue)>=0 && moduleObject.attrs.totalArea=="thisOption"){
								    //如果统计范围为当前项目，去掉项目总数和用户总数这两个选项
								    fieldsArray = Array.from(fieldsArrayAll);
								    fieldsArray.shift();
								    fieldsArray.shift();
								}else{
									fieldsArray=fieldsArrayAll;
								}
								let fieldHtml = '<option selected  value='+fieldsArray[0].key+'>'+fieldsArray[0].label+'</option>';
								for(let t=1,len=fieldsArray.length;t<len;t++){
									fieldHtml += '<option value='+fieldsArray[t].key+'>'+fieldsArray[t].label+'</option>';
								}
								$("#fieldControl").html(fieldHtml);
								layui.form.render("select");
								stageOper.setModuleAttr(moduleObject, "this",
								"field", fieldsArray[0].key);
								break;
							}
						}
						if(selectValue=="/api/equip/info"){
							$("#equipItem").css("display","block");
							$("#totalAreaItem").css("display","none");
							$("#fieldItem").css("display","block");
							$("#sensorBindItem").css("display","none");
							$("#dateTypeItem").css("display","none");
							$("#functionItem").css("display","none");
							var optionId=localStorage.getItem("optionId");
							equipsArray =  eval("initConfig." + initjson.getAllEquipFunction + "("+optionId+",'platform')");
							//console.log(equipsArray);
							let moduleAttrHtml = '<option selected  value='+equipsArray[0].value+'>'+equipsArray[0].label+'</option>';
							for(let i=1,len=equipsArray.length;i<len;i++){
								moduleAttrHtml += '<option value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
							}
							$("#equipIdControl").html(moduleAttrHtml);
							layui.form.render("select");
							stageOper.setModuleAttr(moduleObject, "this",
							"equipId", equipsArray[0].value);
						}else if(selectValue=="/api/sensor/analysis"){
							$("#equipItem").css("display","none");
							$("#totalAreaItem").css("display","none");
							$("#sensorBindItem").css("display","block");
							$("#dateTypeItem").css("display","block");
							$("#functionItem").css("display","block");
							$("#fieldItem").css("display","none");
						}else{
							$("#totalAreaItem").css("display","block");
							$("#equipItem").css("display","none");
							$("#sensorBindItem").css("display","none");
							$("#dateTypeItem").css("display","none");
							$("#functionItem").css("display","none");
							$("#fieldItem").css("display","block");
						}

						stageOper.setModuleAttr(moduleObject, dataApiControl_attr_Where,
							dataApiControl_attr_id, selectValue);

					});
				})(dataApiControl_attr_id, dataApiControl_attr_value, dataApiControl_attr_Where);

			}

			//给统计范围选择添加监听
			for (var j = 0; j < totalAreaControl_array.length; j++) {
				var totalAreaControl_attr_id = totalAreaControl_array[j].attrCode;
				var totalAreaControl_attr_value = totalAreaControl_array[j].attrValue;
				var totalAreaControl_attr_Where = totalAreaControl_array[j].attrWhere;

				(function(totalAreaControl_attr_id, totalAreaControl_attr_value, totalAreaControl_attr_Where) {
					layui.form.on('select(select_totalAreaControl)', function(data) {
						var selectValue = data.value;
						if(selectValue=="thisOption"){
							//如果统计范围为当前项目，去掉项目总数和用户总数这两个选项
							fieldsArray = Array.from(fieldsArrayAll);
							fieldsArray.shift();
							fieldsArray.shift();
						}else{
							fieldsArray=fieldsArrayAll;
						}
						let fieldHtml = '<option selected  value='+fieldsArray[0].key+'>'+fieldsArray[0].label+'</option>';
						for(let t=1,len=fieldsArray.length;t<len;t++){
							fieldHtml += '<option value='+fieldsArray[t].key+'>'+fieldsArray[t].label+'</option>';
						}
						$("#fieldControl").html(fieldHtml);
						layui.form.render("select");
						stageOper.setModuleAttr(moduleObject, "this",
						"field", fieldsArray[0].key);
						stageOper.setModuleAttr(moduleObject, totalAreaControl_attr_Where,
							totalAreaControl_attr_id, selectValue);

					});
				})(totalAreaControl_attr_id, totalAreaControl_attr_value, totalAreaControl_attr_Where);
			}

			//给设备选择添加监听
			for (var j = 0; j < equipIdControl_array.length; j++) {
				var equipIdControl_attr_id = equipIdControl_array[j].attrCode;
				var equipIdControl_attr_value = equipIdControl_array[j].attrValue;
				var equipIdControl_attr_Where = equipIdControl_array[j].attrWhere;

				(function(equipIdControl_attr_id, equipIdControl_attr_value, equipIdControl_attr_Where) {
					layui.form.on('select(select_equipIdControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, equipIdControl_attr_Where,
							equipIdControl_attr_id, selectValue);

					});
				})(equipIdControl_attr_id, equipIdControl_attr_value, equipIdControl_attr_Where);
			}

			//给数据分析时间段选择添加监听
			for (var j = 0; j < dateTypeControl_array.length; j++) {
				var dateTypeControl_attr_id = dateTypeControl_array[j].attrCode;
				var dateTypeControl_attr_value = dateTypeControl_array[j].attrValue;
				var dateTypeControl_attr_Where = dateTypeControl_array[j].attrWhere;

				(function(dateTypeControl_attr_id, dateTypeControl_attr_value, dateTypeControl_attr_Where) {
					layui.form.on('select(select_dateTypeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, dateTypeControl_attr_Where,
							dateTypeControl_attr_id, selectValue);

					});
				})(dateTypeControl_attr_id, dateTypeControl_attr_value, dateTypeControl_attr_Where);
			}

			//给数据分析算法选择添加监听
			for (var j = 0; j < functionControl_array.length; j++) {
				var functionControl_attr_id = functionControl_array[j].attrCode;
				var functionControl_attr_value = functionControl_array[j].attrValue;
				var functionControl_attr_Where = functionControl_array[j].attrWhere;

				(function(functionControl_attr_id, functionControl_attr_value, functionControl_attr_Where) {
					layui.form.on('select(select_functionControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, functionControl_attr_Where,
							functionControl_attr_id, selectValue);

					});
				})(functionControl_attr_id, functionControl_attr_value, functionControl_attr_Where);
			}

			//给数据源字段选择添加监听
			for (var j = 0; j < dataFieldControl_array.length; j++) {
				var dataFieldControl_attr_id = dataFieldControl_array[j].attrCode;
				var dataFieldControl_attr_value = dataFieldControl_array[j].attrValue;
				var dataFieldControl_attr_Where = dataFieldControl_array[j].attrWhere;

				(function(dataFieldControl_attr_id, dataFieldControl_attr_value, dataFieldControl_attr_Where) {
					layui.form.on('select(select_fieldControl)', function(data) {
						var selectValue = data.value;
						if(moduleType=="IMAGES_STATUS" && (selectValue=="is_on" || selectValue=="is_alarm")){
						    $("#imagesStatusItem").css("display","block");
						}else{
							$("#imagesStatusItem").css("display","none");
						}
						stageOper.setModuleAttr(moduleObject, dataFieldControl_attr_Where,
							dataFieldControl_attr_id, selectValue);

					});
				})(dataFieldControl_attr_id, dataFieldControl_attr_value, dataFieldControl_attr_Where);
			}

			//给刷新设定选择添加监听
			for (var j = 0; j < refreshTypeControl_array.length; j++) {
				var refreshTypeControl_attr_id = refreshTypeControl_array[j].attrCode;
				var refreshTypeControl_attr_value = refreshTypeControl_array[j].attrValue;
				var refreshTypeControl_attr_Where = refreshTypeControl_array[j].attrWhere;

				(function(refreshTypeControl_attr_id, refreshTypeControl_attr_value, refreshTypeControl_attr_Where) {
					layui.form.on('select(select_refreshTypeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, refreshTypeControl_attr_Where,
							refreshTypeControl_attr_id, selectValue);

					});
				})(refreshTypeControl_attr_id, refreshTypeControl_attr_value, refreshTypeControl_attr_Where);
			}



			//给字写值控制添加监听
			for (var j = 0; j < readWriteControl_array.length; j++) {
				var readWriteControl_attr_id = readWriteControl_array[j].attrCode;
				var readWriteControl_attr_value = readWriteControl_array[j].attrValue;
				var readWriteControl_attr_Where = readWriteControl_array[j].attrWhere;

				(function(readWriteControl_attr_id, readWriteControl_attr_value, readWriteControl_attr_Where) {
					layui.form.on('select(select_readWriteControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, readWriteControl_attr_Where,
							readWriteControl_attr_id, selectValue);

					});
				})(readWriteControl_attr_id, readWriteControl_attr_value, readWriteControl_attr_Where);
			}


			//给文本变量宽度控制选择添加监听
			for (var j = 0; j < labelValueWidthControl_array.length; j++) {
				var labelValueWidthControl_attr_id = labelValueWidthControl_array[j].attrCode;
				var labelValueWidthControl_attr_value = labelValueWidthControl_array[j].attrValue;
				var labelValueWidthControl_attr_Where = labelValueWidthControl_array[j].attrWhere;

				(function(labelValueWidthControl_attr_id, labelValueWidthControl_attr_value, labelValueWidthControl_attr_Where) {
					layui.form.on('select(select_labelValueWidthControl)', function(data) {
						//debugger;
						var selectValue = data.value;
						var labelWidth = 56;
						var valueWidth = 44;
						if(selectValue=="auto"){
							$("#labelWidthSet").css("display","none");
							$("#valueWidthSet").css("display","none");
							$("#alignTypeControl").css("display","none");
							var moudleShape = moduleObject.findOne('.' + attrWhere);
							//-moudleShape.setAttr('overflow', 'auto');
							var moudleShapeDes = moduleObject.get('.description')[0];
							//描述外面的框
							var descriptionobjRect = moduleObject.get('.descriptionRect')[0];
						    moudleShapeDes.width('auto');
							moudleShapeDes.align('center');
							descriptionobjRect.width(moudleShapeDes.width());
							descriptionobjRect.height(moudleShapeDes.getHeight());
							//值 xy设置
							var complexTextValue = moduleObject.get('.complexTextValue')[0];
							complexTextValue.x(moudleShapeDes.x() + moudleShapeDes.getWidth());
							complexTextValue.y(moudleShapeDes.y());
							complexTextValue.width('auto');
							complexTextValue.align('center');
							//值的框 xy设置
							var rectValue = moduleObject.get('.rectValue')[0];
							rectValue.x(moudleShapeDes.x() + moudleShapeDes.getWidth());
							rectValue.y(moudleShapeDes.y());
							rectValue.width(complexTextValue.width());
							rectValue.height(complexTextValue.getHeight());
						}else{
							$("#labelWidthSet").css("display","block");
							$("#valueWidthSet").css("display","block");
							$("#alignTypeControl").css("display","block");
							var moudleShapeDes = moduleObject.get('.description')[0];
							var descriptionobjRect = moduleObject.get('.descriptionRect')[0];
							labelWidth = moudleShapeDes.getWidth();
							moudleShapeDes.align('right');
							var complexTextValue = moduleObject.get('.complexTextValue')[0];
							valueWidth = complexTextValue.getWidth();
							var rectValue = moduleObject.get('.rectValue')[0];
							complexTextValue.align('right');
							/* moduleObject.attrs.labelWidth = labelWidth;
							moduleObject.attrs.valueWidth = valueWidth; */
							stageOper.setModuleAttr(moduleObject, "descriptionRect,description",
								"labelWidth", labelWidth);
						 	/*stageOper.setModuleAttr(moduleObject, "rectValue,complexTextValue",
								"valueWidth", valueWidth); */
								$('#labelWidth_descriptionRect_input_text').val(labelWidth.toFixed(0));
								$('#valueWidth_rectValue_input_text').val(valueWidth.toFixed(0));

							//stageOper.showModuleAttr(moduleObject);

						}
						stageOper.setModuleAttr(moduleObject, labelValueWidthControl_attr_Where,
							labelValueWidthControl_attr_id, selectValue);

					});
				})(labelValueWidthControl_attr_id, labelValueWidthControl_attr_value, labelValueWidthControl_attr_Where);

			}

			//给文本变量整体对齐选择添加监听
			for (var j = 0; j < alignTypeControl_array.length; j++) {
				var alignTypeControl_attr_id = alignTypeControl_array[j].attrCode;
				var alignTypeControl_attr_value = alignTypeControl_array[j].attrValue;
				var alignTypeControl_attr_Where = alignTypeControl_array[j].attrWhere;

				(function(alignTypeControl_attr_id, alignTypeControl_attr_value, alignTypeControl_attr_Where) {
					layui.form.on('select(select_alignTypeControl)', function(data) {
						//debugger;
						var selectValue = data.value || "right";
						//文字
						var moudleShapeDes = moduleObject.get('.description')[0];
						//值
						var complexTextValue = moduleObject.get('.complexTextValue')[0];
						if(selectValue=="right"){
							moudleShapeDes.align('right');
							complexTextValue.align('right');
						}else if(selectValue=="left"){
							moudleShapeDes.align('left');
							complexTextValue.align('left');
						}else if(selectValue=="center"){
							moudleShapeDes.align('right');
							complexTextValue.align('left');
						}else if(selectValue=="justify"){
							moudleShapeDes.align('left');
							complexTextValue.align('right');
						}
						stageOper.setModuleAttr(moduleObject, alignTypeControl_attr_Where,
							alignTypeControl_attr_id, selectValue);
			        });
				})(alignTypeControl_attr_id, alignTypeControl_attr_value, alignTypeControl_attr_Where);

			}




			//给跳转方式控制添加监听
			for (var j = 0; j < changeTypeControl_array.length; j++) {
				var changeTypeControl_attr_id = changeTypeControl_array[j].attrCode;
				var changeTypeControl_attr_value = changeTypeControl_array[j].attrValue;
				var changeTypeControl_attr_Where = changeTypeControl_array[j].attrWhere;

				(function(changeTypeControl_attr_id, changeTypeControl_attr_value, changeTypeControl_attr_Where) {
					layui.form.on('select(select_changeTypeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, changeTypeControl_attr_Where,
							changeTypeControl_attr_id, selectValue);

					});
				})(changeTypeControl_attr_id, changeTypeControl_attr_value, changeTypeControl_attr_Where);
			}

			//给复位类型控制添加监听
			for (var j = 0; j < resetTypeControl_array.length; j++) {
				var resetTypeControl_attr_id = resetTypeControl_array[j].attrCode;
				var resetTypeControl_attr_value = resetTypeControl_array[j].attrValue;
				var resetTypeControl_attr_Where = resetTypeControl_array[j].attrWhere;

				(function(resetTypeControl_attr_id, resetTypeControl_attr_value, resetTypeControl_attr_Where) {
					layui.form.on('select(select_resetTypeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, resetTypeControl_attr_Where,
							resetTypeControl_attr_id, selectValue);

					});
				})(resetTypeControl_attr_id, resetTypeControl_attr_value, resetTypeControl_attr_Where);
			}


			//给监控模块控制添加监听
			for (var j = 0; j < tabTypesControl_array.length; j++) {
				var tabTypesControl_attr_id = tabTypesControl_array[j].attrCode;
				var tabTypesControl_attr_value = tabTypesControl_array[j].attrValue;
				var tabTypesControl_attr_Where = tabTypesControl_array[j].attrWhere;

				(function(tabTypesControl_attr_id, tabTypesControl_attr_value, tabTypesControl_attr_Where) {
					layui.form.on('select(select_tabTypesControl)', function(data) {
						var selectValue = data.value;
						console.log(selectValue);
						if (data.value == "historyData") {
							$("#showTypeItem").css("display", "block");
						} else {
							$("#showTypeItem").css("display", "none");
						}

            if (data.value == "data") {
            	$("#sensorBoxColorItem").css("display", "block");
            }else{
            	$("#sensorBoxColorItem").css("display", "none");
            }
						if(['data','historyChart','analysis','statement'].indexOf(selectValue)>=0){
							$("#pageSizeItem").css("display","none");
							if(selectValue=='analysis' || selectValue=='statement'){
								$("#headBackgroundItem").css("display","block");
								$("#fieldColorItem").css("display","block");
								$("#tableBorderColorItem").css("display","block");
								$("#tableTextColorItem").css("display","block");
							}else{
								$("#headBackgroundItem").css("display","none");
								$("#fieldColorItem").css("display","none");
								$("#tableBorderColorItem").css("display","none");
								$("#tableTextColorItem").css("display","none");
							}
						}else{
						    $("#pageSizeItem").css("display","block");
							$("#headBackgroundItem").css("display","block");
							$("#fieldColorItem").css("display","block");
							$("#tableBorderColorItem").css("display","block");
							$("#tableTextColorItem").css("display","block");
						}
						viewDataType = data.value;
						sessionStorage.setItem("defaultArgments","");

						stageOper.setModuleAttr(moduleObject, tabTypesControl_attr_Where,
							tabTypesControl_attr_id, selectValue);

					});
				})(tabTypesControl_attr_id, tabTypesControl_attr_value, tabTypesControl_attr_Where);
			}

			//给面板样式控制添加监听
			for (var j = 0; j < showStyleControl_array.length; j++) {
				var showStyleControl_attr_id = showStyleControl_array[j].attrCode;
				var showStyleControl_attr_value = showStyleControl_array[j].attrValue;
				var showStyleControl_attr_Where = showStyleControl_array[j].attrWhere;

				(function(showStyleControl_attr_id, showStyleControl_attr_value, showStyleControl_attr_Where) {
					layui.form.on('select(select_showStyleControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, showStyleControl_attr_Where,
							showStyleControl_attr_id, selectValue);

					});
				})(showStyleControl_attr_id, showStyleControl_attr_value, showStyleControl_attr_Where);
			}

			//给监控面板表格每页条数添加监听
			for (var j = 0; j < pageSizeControl_array.length; j++) {
				var pageSizeControl_attr_id = pageSizeControl_array[j].attrCode;
				var pageSizeControl_attr_value = pageSizeControl_array[j].attrValue;
				var pageSizeControl_attr_Where = pageSizeControl_array[j].attrWhere;

				(function(pageSizeControl_attr_id, pageSizeControl_attr_value, pageSizeControl_attr_Where) {
					layui.form.on('select(select_pageSizeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, pageSizeControl_attr_Where,
							pageSizeControl_attr_id, selectValue);

					});
				})(pageSizeControl_attr_id, pageSizeControl_attr_value, pageSizeControl_attr_Where);
			}

			//给监控面板历史数据显示方式添加监听
			for (var j = 0; j < showTypeControl_array.length; j++) {
				var showTypeControl_attr_id = showTypeControl_array[j].attrCode;
				var showTypeControl_attr_value = showTypeControl_array[j].attrValue;
				var showTypeControl_attr_Where = showTypeControl_array[j].attrWhere;

				(function(showTypeControl_attr_id, showTypeControl_attr_value, showTypeControl_attr_Where) {
					layui.form.on('select(select_showTypeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, showTypeControl_attr_Where,
							showTypeControl_attr_id, selectValue);

					});
				})(showTypeControl_attr_id, showTypeControl_attr_value, showTypeControl_attr_Where);
			}



			//给地图功能控制添加监听
			for (var j = 0; j < mapUseControl_array.length; j++) {
				var mapUseControl_attr_id = mapUseControl_array[j].attrCode;
				var mapUseControl_attr_value = mapUseControl_array[j].attrValue;
				var mapUseControl_attr_Where = mapUseControl_array[j].attrWhere;

				(function(mapUseControl_attr_id, mapUseControl_attr_value, mapUseControl_attr_Where) {
					layui.form.on('select(select_mapUseControl)', function(data) {
						var selectValue = data.value;
						if(selectValue == "locus"){
							$("#equipMapItem").css("display","block");
							let optionId=localStorage.getItem("optionId");
							equipsArray =  eval("initConfig." + initjson.getAllEquipFunction + "("+optionId+",'map')");
							console.log(equipsArray);
							let moduleAttrHtml = '';
							if(equipsArray.length){
								moduleAttrHtml += '<option selected  value='+equipsArray[0].value+'>'+equipsArray[0].label+'</option>';
								for(let i=1,len=equipsArray.length;i<len;i++){
									moduleAttrHtml += '<option value='+equipsArray[i].value+'>'+equipsArray[i].label+'</option>';
								}
							    stageOper.setModuleAttr(moduleObject, "this",
							    "equipId", equipsArray[0].value);
							}
							$("#equipMapControl").html(moduleAttrHtml);
							layui.form.render("select");
						}else{
							$("#equipMapItem").css("display","none");
						}
						stageOper.setModuleAttr(moduleObject, mapUseControl_attr_Where,
							mapUseControl_attr_id, selectValue);

					});
				})(mapUseControl_attr_id, mapUseControl_attr_value, mapUseControl_attr_Where);
			}

			//给地图设备轨迹功能的设备选择控制添加监听
			for (var j = 0; j < equipMapControl_array.length; j++) {
				var equipMapControl_attr_id = equipMapControl_array[j].attrCode;
				var equipMapControl_attr_value = equipMapControl_array[j].attrValue;
				var equipMapControl_attr_Where = equipMapControl_array[j].attrWhere;

				(function(equipMapControl_attr_id, equipMapControl_attr_value, equipMapControl_attr_Where) {
					layui.form.on('select(select_equipMapControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, equipMapControl_attr_Where,
							equipMapControl_attr_id, selectValue);

					});
				})(equipMapControl_attr_id, equipMapControl_attr_value, equipMapControl_attr_Where);
			}



			//给地图风格样式控制添加监听
			for (var j = 0; j < mapStyleControl_array.length; j++) {
				var mapStyleControl_attr_id = mapStyleControl_array[j].attrCode;
				var mapStyleControl_attr_value = mapStyleControl_array[j].attrValue;
				var mapStyleControl_attr_Where = mapStyleControl_array[j].attrWhere;

				(function(mapStyleControl_attr_id, mapStyleControl_attr_value, mapStyleControl_attr_Where) {
					layui.form.on('select(select_mapStyleControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, mapStyleControl_attr_Where,
							mapStyleControl_attr_id, selectValue);

					});
				})(mapStyleControl_attr_id, mapStyleControl_attr_value, mapStyleControl_attr_Where);
			}

			//给历史曲线默认时段控制添加监听
			for (var j = 0; j < dateRangeControl_array.length; j++) {
				var dateRangeControl_attr_id = dateRangeControl_array[j].attrCode;
				var dateRangeControl_attr_value = dateRangeControl_array[j].attrValue;
				var dateRangeControl_attr_Where = dateRangeControl_array[j].attrWhere;

				(function(dateRangeControl_attr_id, dateRangeControl_attr_value, dateRangeControl_attr_Where) {
					layui.form.on('select(select_dateRangeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, dateRangeControl_attr_Where,
							dateRangeControl_attr_id, selectValue);

					});
				})(dateRangeControl_attr_id, dateRangeControl_attr_value, dateRangeControl_attr_Where);
			}

			//给高级监控界面模板控制添加监听
			for (var j = 0; j < videoModeControl_array.length; j++) {
				var videoModeControl_attr_id = videoModeControl_array[j].attrCode;
				var videoModeControl_attr_value = videoModeControl_array[j].attrValue;
				var videoModeControl_attr_Where = videoModeControl_array[j].attrWhere;

				(function(videoModeControl_attr_id, videoModeControl_attr_value, videoModeControl_attr_Where) {
					layui.form.on('select(select_videoModeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, videoModeControl_attr_Where,
							videoModeControl_attr_id, selectValue);

					});
				})(videoModeControl_attr_id, videoModeControl_attr_value, videoModeControl_attr_Where);
			}


			//内嵌面板嵌入类型的选择控制
			for (var j = 0; j < insertTypeControl_array.length; j++) {
				var insertTypeControl_attr_id = insertTypeControl_array[j].attrCode;
				var insertTypeControl_attr_value = insertTypeControl_array[j].attrValue;
				var insertTypeControl_attr_Where = insertTypeControl_array[j].attrWhere;

				(function(insertTypeControl_attr_id, insertTypeControl_attr_value, insertTypeControl_attr_Where) {
					layui.form.on('select(select_insertTypeControl)', function(data) {
						var selectValue = data.value;
						console.log(data.value);
						if(data.value=='view'){
							$("#insertIframe").css("display","none");
							$("#insertViewItem").css("display","block");
							if(!insertViewArray.length){
							    insertViewArray = eval("initConfig.getDrawsMoudleData(" + localStorage.getItem('editViewId') + ")");
							}
							if(insertViewArray.length){
								let moduleAttrHtml = '';
								moduleAttrHtml += '<option selected  value='+insertViewArray[0].id+'>'+insertViewArray[0].draw_name+'</option>';
								for(let i=1,len=insertViewArray.length;i<len;i++){
									moduleAttrHtml += '<option value='+insertViewArray[i].id+'>'+insertViewArray[i].draw_name+'</option>';
								}
								stageOper.setModuleAttr(moduleObject, "this",
								"insertView", insertViewArray[0].id);


								$("#insertViewControl").html(moduleAttrHtml);
								layui.form.render("select");
							}


						}else{
							$("#insertViewItem").css("display","none");
							$("#insertIframe").css("display","block");
						}
						stageOper.setModuleAttr(moduleObject, insertTypeControl_attr_Where,
							insertTypeControl_attr_id, selectValue);

					});
				})(insertTypeControl_attr_id, insertTypeControl_attr_value, insertTypeControl_attr_Where);
			}

			//嵌入类型为图纸的图纸选择控制
			for (var j = 0; j < insertViewControl_array.length; j++) {
				var insertViewControl_attr_id = insertViewControl_array[j].attrCode;
				var insertViewControl_attr_value = insertViewControl_array[j].attrValue;
				var insertViewControl_attr_Where = insertViewControl_array[j].attrWhere;

				(function(insertViewControl_attr_id, insertViewControl_attr_value, insertViewControl_attr_Where) {
					layui.form.on('select(select_insertViewControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, insertViewControl_attr_Where,
							insertViewControl_attr_id, selectValue);

					});
				})(insertViewControl_attr_id, insertViewControl_attr_value, insertViewControl_attr_Where);
			}

			//给写值二次输入控制添加监听
			for (var j = 0; j < secondControl_array.length; j++) {
				var secondControl_attr_id = secondControl_array[j].attrCode;
				var secondControl_attr_value = secondControl_array[j].attrValue;
				var secondControl_attr_Where = secondControl_array[j].attrWhere;

				(function(secondControl_attr_id, secondControl_attr_value, secondControl_attr_Where) {
					layui.form.on('select(select_secondControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, secondControl_attr_Where,
							secondControl_attr_id, selectValue);

					});
				})(secondControl_attr_id, secondControl_attr_value, secondControl_attr_Where);
			}

			//给echart排序方式控制添加监听
			for (var j = 0; j < sortTypeControl_array.length; j++) {
				var sortTypeControl_attr_id = sortTypeControl_array[j].attrCode;
				var sortTypeControl_attr_value = sortTypeControl_array[j].attrValue;
				var sortTypeControl_attr_Where = sortTypeControl_array[j].attrWhere;

				(function(sortTypeControl_attr_id, sortTypeControl_attr_value, sortTypeControl_attr_Where) {
					layui.form.on('select(select_sortTypeControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, sortTypeControl_attr_Where,
							sortTypeControl_attr_id, selectValue);

					});
				})(sortTypeControl_attr_id, sortTypeControl_attr_value, sortTypeControl_attr_Where);
			}

			//给echart排序X轴显示方式控制添加监听
			for (var j = 0; j < showTypeXControl_array.length; j++) {
				var showTypeXControl_attr_id = showTypeXControl_array[j].attrCode;
				var showTypeXControl_attr_value = showTypeXControl_array[j].attrValue;
				var showTypeXControl_attr_Where = showTypeXControl_array[j].attrWhere;

				(function(showTypeXControl_attr_id, showTypeXControl_attr_value, showTypeXControl_attr_Where) {
					layui.form.on('select(select_showTypeXControl)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, showTypeXControl_attr_Where,
							showTypeXControl_attr_id, selectValue);

					});
				})(showTypeXControl_attr_id, showTypeXControl_attr_value, showTypeXControl_attr_Where);
			}

			//给初始开合添加监听
			for (var j = 0; j < on_off_array.length; j++) {
				var on_off_attr_id = on_off_array[j].attrCode;
				var on_off_attr_value = on_off_array[j].attrValue;
				var on_off_attr_Where = on_off_array[j].attrWhere;

				(function(on_off_attr_id, on_off_attr_value, on_off_attr_Where) {
					layui.form.on('select(select_onOff)', function(data) {
						var selectValue = data.value;
						stageOper.setModuleAttr(moduleObject, on_off_attr_Where, on_off_attr_id,
							selectValue);

					});
				})(on_off_attr_id, on_off_attr_value, on_off_attr_Where);
			}



			//给绑定的硬件添加监听

			for (var j = 0; j < hardware_input_array.length; j++) {

				var hardware_attr_id = hardware_input_array[j].attrCode + '_' + hardware_input_array[j]
					.attrWhere;

				// var hardware_attr_id=hardware_array[j].attrCode;
				var hardware_attr_value = hardware_input_array[j].attrValue;
				var hardware_attr_Where = hardware_input_array[j].attrWhere;

				(function(hardware_attr_id, hardware_attr_value, hardware_attr_Where) {
					$('#' + hardware_attr_id + '_input_text').on('click', function() {
						var current_input = $(this);
						// var input_value = $('#' + hardware_attr_id + '_input_text')
						// 	.val(); // 当前文本框的值
						// 当前文本框的name值,即数据点ID
						var input_value = $(this).attr('name');
						layer.open({
							title: '请选择需要绑定的数据点<span style="color:#ff0000">(已过滤空设备和空分组)</span>',
							type: 2,
							area: ['820px', '700px'],
              skin: 'layer-class',
              //area: '1000px',
              //area: ['1000px', 'auto'],
							fixed: false, //不固定
              //offset:10,
							maxmin: true,
							content: 'hardwareSelect.html?hardware_id=' + input_value,
							end: function(index, layero) {
								//   var hardware_id="";//当前选择的硬件传感器数据点的id
								//    var hardware_Text="";//当前选择的硬件传感器数据点的描述

								if (hardware_id !== '') {
									current_input.val(hardware_Text);
									var hardValue = "[{key:'" + hardware_id +
										"',name:'" + hardware_Text + "'}]";
									var hardware_attr_code = hardware_attr_id.split(
										"_")[0];
									stageOper.setModuleAttr(moduleObject,
										hardware_attr_Where, hardware_attr_code,
										eval(hardValue));

									hardware_id = "";
									hardware_Text = "";
								}else{
									//清除输入框内容
									// current_input.val('');
									// var hardValue = "[{key:'',name:''}]";
									// var hardware_attr_code = hardware_attr_id.split(
									// 	"_")[0];
									// stageOper.setModuleAttr(moduleObject,
									// 	hardware_attr_Where, hardware_attr_code,
									// 	eval(hardValue));

									// hardware_id = "";
									// hardware_Text = "";
								}

							}

						});


					});

				})(hardware_attr_id, hardware_attr_value, hardware_attr_Where);
			}


			// 给跳转画面属性绑定监听
			for (var j = 0; j < jump_input_array.length; j++) {

				var jump_attr_id = jump_input_array[j].attrCode + '_' + jump_input_array[j].attrWhere.split(
					",")[0];

				// var hardware_attr_id=hardware_array[j].attrCode;
				var jump_attr_value = jump_input_array[j].attrValue;
				var jump_attr_Where = jump_input_array[j].attrWhere;

				(function(jump_attr_id, jump_attr_value, jump_attr_Where) {
					$('#' + jump_attr_id + '_input_text').on('click', function() {
						var current_input = $(this);
						layer.open({
							title: '请选择需要跳转到的画面',
							type: 2,
							area: ['800px', '400px'],
              skin: 'layer-class',
							fixed: false, //不固定
							maxmin: true,
							content: 'targetStage.html?userId=' + userId,
							end: function(index, layero) {


								if (targetStage !== '') {

									var target_Id = targetStage.split("-")[0];
									var target_Name = targetStage.split("-")[1];
									current_input.val(target_Name + "-" + target_Id);
									var targetObj = "{targetName:'" + target_Name +
										"',targetCode:'" + target_Id + "'}";
									var jump_attr_code = jump_attr_id.split("_")[0];
									stageOper.setModuleAttr(moduleObject,
										jump_attr_Where, jump_attr_code, targetObj);
									targetStage = "";
								}

							}

						});


					});

				})(jump_attr_id, jump_attr_value, jump_attr_Where);
			}



			//初始化水流动画条件
			if (where_array.length > 0) {
				var where_attr_id = where_array[0].attrCode;
				var where_attr_value = where_array[0].attrValue;
				var where_attr_Where = where_array[0].attrWhere;
				var where_attr_Type = where_array[0].attrType;
				var where_attr_Name = where_array[0].attrName;
				var whereObjArray = eval('(' + where_attr_value + ')');
				(function(where_attr_id, where_attr_value, where_attr_Where, where_attr_Type, where_attr_Name,
					whereObjArray) {


					var table_data = new Array();
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.code = whereObj_t.direction;

						var whereCode = whereObj_t.where;
						//处理whereCode 拿到最大值 最小值
						obj_t.min = whereCode.min;
						obj_t.max = whereCode.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + where_attr_Type,
						toolbar: '<div style="float: left">' + where_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[

								{
									field: 'selectfx',
									align: 'center',
									width: 126,
									title: '流动效果',
									templet: '#flowAnimationOption'
								}, {
									field: 'min',
									align: 'center',
									width: 46,
									title: '小值(>=)',
									edit: 'text'
								}, {
									field: 'max',
									align: 'center',
									width: 46,
									title: '大值(<=)',
									edit: 'text'
								}, {
									title: '操作',
									align: 'center',
									width: 58,
									toolbar: '#wherebar'
								}

							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + where_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"code": "",
									"min": "",
									"max": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + where_attr_Type + ')', function(obj) {
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject, where_attr_Where,
										where_attr_id, table.cache[tableView.attr(
											"lay-id")]);

								}



								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + where_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, where_attr_Where, where_attr_id, table
							.cache[tableView.attr("lay-id")]);
					});

					//这是监听下拉框改变
					form.on('select(flowAnimationOption_select)', function(data) {
						var selectElem = $(data.elem);
						var tdElem = selectElem.closest("td");
						var trElem = tdElem.closest("tr");
						var tableView = trElem.closest(".layui-table-view");
						var jyzt_lay_id = tableView.attr("lay-id"); //layui表格的id
						table.cache[tableView.attr("lay-id")][trElem.data("index")]['code'] = data
							.value;

						/* var elem = $(data.elem);
						 var trElem = elem.parents('tr');
						 var tableData = table.cache['whereSelectTable'];
						 // 更新到表格的缓存数据中，才能在获得选中行等等其他的方法中得到更新之后的值
						 var nndg = trElem.data('index');
						 var nnc =elem.attr('name');
						 tableData[trElem.data('index')]['code'] = data.value;*/

						stageOper.setModuleAttr(moduleObject, where_attr_Where, where_attr_id, table
							.cache[tableView.attr("lay-id")]);

					});
				})(where_attr_id, where_attr_value, where_attr_Where, where_attr_Type, where_attr_Name,
					whereObjArray);
			}


			//初始化状态值
			if (whereStatus_array.length > 0) {
				var whereStatus_attr_id = whereStatus_array[0].attrCode;
				var whereStatus_attr_value = whereStatus_array[0].attrValue;
				var whereStatus_attr_Where = whereStatus_array[0].attrWhere;
				var whereStatus_attr_Type = whereStatus_array[0].attrType;
				var whereStatus_attr_Name = whereStatus_array[0].attrName;

				var whereObjArray = eval('(' + whereStatus_attr_value + ')');

				(function(whereStatus_attr_id, whereStatus_attr_value, whereStatus_attr_Where,
					whereStatus_attr_Type, whereStatus_attr_Name, whereObjArray) {



					var table_data = new Array();
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.description = whereObj_t.description;

						var whereCode = whereObj_t.where;
						//处理whereCode 拿到最大值 最小值
						obj_t.min = whereCode.min;
						obj_t.max = whereCode.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + whereStatus_attr_Type,
						toolbar: '<div style="float: left">' + whereStatus_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[


								{
									field: 'min',
									align: 'center',
									width: 52,
									title: '>=',
									edit: 'text'
								}, {
									field: 'max',
									align: 'center',
									width: 52,
									title: '<=',
									edit: 'text'
								}, {
									field: 'description',
									align: 'center',
									width: 112,
									title: '对应翻译文字',
									edit: 'text'
								}, {
									title: '操作',
									align: 'center',
									width: 60,
									toolbar: '#wherebar'
								}

							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + whereStatus_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"description": "",
									"min": "",
									"max": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + whereStatus_attr_Type + ')', function(obj) {
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject,
										whereStatus_attr_Where, whereStatus_attr_id,
										table.cache[tableView.attr("lay-id")]);

								}



								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + whereStatus_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, whereStatus_attr_Where,
							whereStatus_attr_id, table.cache[tableView.attr("lay-id")]);
					});

				})(whereStatus_attr_id, whereStatus_attr_value, whereStatus_attr_Where, whereStatus_attr_Type,
					whereStatus_attr_Name, whereObjArray);

			}

			//初始化状态灯
			if (whereStatusLight_array.length > 0) {
				var whereStatusLight_attr_id = whereStatusLight_array[0].attrCode;
				var whereStatusLight_attr_value = whereStatusLight_array[0].attrValue;
				var whereStatusLight_attr_Where = whereStatusLight_array[0].attrWhere;
				var whereStatusLight_attr_Type = whereStatusLight_array[0].attrType;
				var whereStatusLight_attr_Name = whereStatusLight_array[0].attrName;

				var whereObjArray = eval('(' + whereStatusLight_attr_value + ')');
				(function(whereStatusLight_attr_id, whereStatusLight_attr_value, whereStatusLight_attr_Where,
					whereStatusLight_attr_Type, whereStatusLight_attr_Name, whereObjArray) {


					var table_data = new Array();
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.color = whereObj_t.color;

						var whereCode = whereObj_t.where;
						//处理whereCode 拿到最大值 最小值
						obj_t.min = whereCode.min;
						obj_t.max = whereCode.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + whereStatusLight_attr_Type,
						toolbar: '<div style="float: left">' + whereStatusLight_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						done: function(res, curr, count) {
							//如果是异步请求数据方式，res即为你接口返回的信息。
							//如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
							//console.log(res);
							//得到当前页码
							//console.log(curr);
							//得到数据总量
							//console.log(count);

							//初始化表格里的原色选择块
							var selectTableColorArray = $('div[id^="selectTableColor_"]');
							$.each(selectTableColorArray, function(index, domEle) {
								//selectTableColorArray 是要遍历的集合
								// index就是索引值
								//domEle 表示获取遍历每一个dom对
								// alert(domEle.id);

								colorpicker.render({
									elem: '#' + domEle.id,
									color: domEle.attributes["color"].value,
									predefine: true,
									change: function(color) {
										var divColorElem = $(this.elem);
										var tdElem = divColorElem.closest(
											"td");
										var trElem = tdElem.closest("tr");
										var tableView = trElem.closest(
											".layui-table-view");
										var jyzt_lay_id = tableView.attr(
											"lay-id"); //layui表格的id
										table.cache[tableView.attr(
											"lay-id")][trElem.data(
											"index")]['color'] = color;
										stageOper.setModuleAttr(
											moduleObject,
											whereStatusLight_attr_Where,
											whereStatusLight_attr_id,
											table.cache[tableView.attr(
												"lay-id")]);

									}
								});
							});
						},
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[


								{
									field: 'min',
									align: 'center',
									width: 60,
									title: '>=',
									edit: 'text'
								}, {
									field: 'max',
									align: 'center',
									width: 60,
									title: '<=',
									edit: 'text'
								}, {
									field: 'colorSelect',
									align: 'center',
									width: 100,
									title: '对应的颜色',
									toolbar: '#layuiTableColorSelect'
								}, {
									title: '操作',
									align: 'center',
									width: 56,
									toolbar: '#wherebar'
								}

							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + whereStatusLight_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"color": "",
									"min": "",
									"max": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + whereStatusLight_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject,
										whereStatusLight_attr_Where,
										whereStatusLight_attr_id, table.cache[tableView
											.attr("lay-id")]);

								}



								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + whereStatusLight_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, whereStatusLight_attr_Where,
							whereStatusLight_attr_id, table.cache[tableView.attr("lay-id")]);
					});




				})(whereStatusLight_attr_id, whereStatusLight_attr_value, whereStatusLight_attr_Where,
					whereStatusLight_attr_Type, whereStatusLight_attr_Name, whereObjArray);


			}

			//初始化-开合状态
			if (ON_OFFSTATET_array.length > 0) {
				var ON_OFFSTATET_attr_id = ON_OFFSTATET_array[0].attrCode;
				var ON_OFFSTATET_attr_value = ON_OFFSTATET_array[0].attrValue;
				var ON_OFFSTATET_attr_Where = ON_OFFSTATET_array[0].attrWhere;
				var ON_OFFSTATET_attr_Type = ON_OFFSTATET_array[0].attrType;
				var ON_OFFSTATET_attr_Name = ON_OFFSTATET_array[0].attrName;

				var whereObjArray = eval('(' + ON_OFFSTATET_attr_value + ')');
				(function(ON_OFFSTATET_attr_id, ON_OFFSTATET_attr_value, ON_OFFSTATET_attr_Where,
					ON_OFFSTATET_attr_Type, ON_OFFSTATET_attr_Name, whereObjArray) {


					var table_data = new Array();
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};


						obj_t.textState = whereObj_t.textState;
						obj_t.color = whereObj_t.color;
						var whereCode = whereObj_t.where;
						//处理whereCode 拿到最大值 最小值
						obj_t.min = whereCode.min;
						obj_t.max = whereCode.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + ON_OFFSTATET_attr_Type,
						toolbar: '<div style="float: left">' + ON_OFFSTATET_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						done: function(res, curr, count) {
							//如果是异步请求数据方式，res即为你接口返回的信息。
							//如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
							//console.log(res);
							//得到当前页码
							//console.log(curr);
							//得到数据总量
							//console.log(count);

							//初始化表格里的原色选择块
							var selectTableColorArray = $('div[id^="selectTableColor_"]');
							$.each(selectTableColorArray, function(index, domEle) {
								//selectTableColorArray 是要遍历的集合
								// index就是索引值
								//domEle 表示获取遍历每一个dom对
								// alert(domEle.id);

								colorpicker.render({
									elem: '#' + domEle.id,
									color: domEle.attributes["color"].value,
									predefine: true,
									change: function(color) {
										var divColorElem = $(this.elem);
										var tdElem = divColorElem.closest(
											"td");
										var trElem = tdElem.closest("tr");
										var tableView = trElem.closest(
											".layui-table-view");
										var jyzt_lay_id = tableView.attr(
											"lay-id"); //layui表格的id
										table.cache[tableView.attr(
											"lay-id")][trElem.data(
											"index")]['color'] = color;
										stageOper.setModuleAttr(
											moduleObject,
											ON_OFFSTATET_attr_Where,
											ON_OFFSTATET_attr_id, table
											.cache[tableView.attr(
												"lay-id")]);

									}
								});
							});



						},
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[

								{
									field: 'textState',
									align: 'center',
									width: 50,
									title: '开合描述'
								},
								{
									field: 'min',
									align: 'center',
									width: 70,
									title: '小值(>=)',
									edit: 'text'
								}, {
									field: 'max',
									align: 'center',
									width: 70,
									title: '大值(<=)',
									edit: 'text'
								}, {
									field: 'colorSelect',
									align: 'center',
									width: 68,
									title: '对应颜色',
									toolbar: '#layuiTableColorSelect'
								}

							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + ON_OFFSTATET_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});


					//这是监听可编辑的
					table.on('edit(' + ON_OFFSTATET_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, ON_OFFSTATET_attr_Where,
							ON_OFFSTATET_attr_id, table.cache[tableView.attr("lay-id")]);
					});




				})(ON_OFFSTATET_attr_id, ON_OFFSTATET_attr_value, ON_OFFSTATET_attr_Where,
					ON_OFFSTATET_attr_Type, ON_OFFSTATET_attr_Name, whereObjArray);


			}


			//初始化开关
			if (whereStatusSwitch_array.length > 0) {
				var whereStatusSwitch_attr_id = whereStatusSwitch_array[0].attrCode;
				var whereStatusSwitch_attr_value = whereStatusSwitch_array[0].attrValue;
				var whereStatusSwitch_attr_Where = whereStatusSwitch_array[0].attrWhere;
				var whereStatusSwitch_attr_Type = whereStatusSwitch_array[0].attrType;
				var whereStatusSwitch_attr_Name = whereStatusSwitch_array[0].attrName;


				var whereObjArray = eval('(' + whereStatusSwitch_attr_value + ')');
				(function(whereStatusSwitch_attr_id, whereStatusSwitch_attr_value, whereStatusSwitch_attr_Where,
					whereStatusSwitch_attr_Type, whereStatusSwitch_attr_Name, whereObjArray) {


					var table_data = new Array();
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.description = whereObj_t.description;
						obj_t.status = whereObj_t.status;
						obj_t.command = whereObj_t.command;
						obj_t.icon = whereObj_t.icon;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + whereStatusSwitch_attr_Type,
						toolbar: '<div style="float: left">' + whereStatusSwitch_attr_Name +
							'</div>',
						defaultToolbar: [{
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						done: function(res, curr, count) {
							//如果是异步请求数据方式，res即为你接口返回的信息。
							//如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
							//console.log(res);
							//得到当前页码
							//console.log(curr);
							//得到数据总量
							//console.log(count);

							//初始化表格里的原色选择块
							var selectTableSwitchArray = $('img[id^="selectTableSwitch_"]');
							$.each(selectTableSwitchArray, function(index, domEle) {
								$("#" + domEle.id).click(function(e) {
									var divSwitchElem = $(this);
									var tdElem = divSwitchElem.closest("td");
									var trElem = tdElem.closest("tr");
									var tableView = trElem.closest(
										".layui-table-view");
									// var jyzt_lay_id = tableView.attr("lay-id");//layui表格的id
									layer.open({
										title: '请选择开关图标<span style="color:#ff0000;font-size:14px;">(使用内置开关默认显示0值图标,使用我的图库默认显示首项图标)</span>',
										type: 2,
										area: ['750px', '350px'],
                    skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'switchIconList.html',
										end: function(index, layero) {
											if (switchIconUrl !==
												'') {
												table.cache[
														tableView
														.attr(
															"lay-id"
														)][
														trElem.data(
															"index")
													]['icon'] =
													switchIconUrl;
												table.reload(
													tableView
													.attr(
														"lay-id"
													), {
														data: table
															.cache[
																tableView
																.attr(
																	"lay-id"
																)
															]
													});
												stageOper
													.setModuleAttr(
														moduleObject,
														whereStatusSwitch_attr_Where,
														whereStatusSwitch_attr_id,
														table.cache[
															tableView
															.attr(
																"lay-id"
															)]);
											}

										}

									});
								});
							});



						},
						even: true,
						limit: Number.MAX_VALUE, // 数据表格默认全部显示
						data: table_data,
						cols: [
							[{
									field: 'description',
									align: 'center',
									width: 80,
									title: '开关'
								},
								{
									field: 'status',
									align: 'center',
									width: 56,
									title: '状态值',
									edit: 'text'
								},
								{
									field: 'command',
									align: 'center',
									width: 72,
									title: '点击命令',
									edit: 'text'
								},
								{
									field: 'icon',
									align: 'center',
									width: 74,
									title: '图标',
									toolbar: '#layuiTableSwitchSelect'
								}

							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + whereStatusSwitch_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};
					});

					//这是监听可编辑的
					table.on('edit(' + whereStatusSwitch_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, whereStatusSwitch_attr_Where,
							whereStatusSwitch_attr_id, table.cache[tableView.attr("lay-id")]);
					});

				})(whereStatusSwitch_attr_id, whereStatusSwitch_attr_value, whereStatusSwitch_attr_Where,
					whereStatusSwitch_attr_Type, whereStatusSwitch_attr_Name, whereObjArray);
			}
			//初始化值缩放
			if (valueZoomConfig_array.length > 0) {
				var valueZoomConfig_attr_id = valueZoomConfig_array[0].attrCode;
				var valueZoomConfig_attr_value = valueZoomConfig_array[0].attrValue;
				var valueZoomConfig_attr_Where = valueZoomConfig_array[0].attrWhere;
				var valueZoomConfig_attr_Type = valueZoomConfig_array[0].attrType;
				var valueZoomConfig_attr_Name = valueZoomConfig_array[0].attrName;


				var whereObjArray = eval('(' + valueZoomConfig_attr_value + ')');
				(function(valueZoomConfig_attr_id, valueZoomConfig_attr_value, valueZoomConfig_attr_Where,
					valueZoomConfig_attr_Type, valueZoomConfig_attr_Name, whereObjArray) {


					var table_data = new Array();;
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.zoomSize = whereObj_t.zoomSize;
						obj_t.decimalDigits = whereObj_t.decimalDigits;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + valueZoomConfig_attr_Type,
						toolbar: '<div style="float: left">' + valueZoomConfig_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[{
									field: 'zoomSize',
									align: 'center',
									width: 130,
									title: '倍数',
									edit: 'text'
								},
								{
									field: 'decimalDigits',
									align: 'center',
									width: 130,
									title: '小数位',
									edit: 'text'
								}
							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + valueZoomConfig_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//这是监听可编辑的
					table.on('edit(' + valueZoomConfig_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, valueZoomConfig_attr_Where,
							valueZoomConfig_attr_id, table.cache[tableView.attr("lay-id")]);
					});

				})(valueZoomConfig_attr_id, valueZoomConfig_attr_value, valueZoomConfig_attr_Where,
					valueZoomConfig_attr_Type, valueZoomConfig_attr_Name, whereObjArray);
			}


			//初始化状态图片
			if (imagesStatusTable_array.length > 0) {
				var imagesStatusTable_attr_id = imagesStatusTable_array[0].attrCode;
				var imagesStatusTable_attr_value = imagesStatusTable_array[0].attrValue;
				var imagesStatusTable_attr_Where = imagesStatusTable_array[0].attrWhere;
				var imagesStatusTable_attr_Type = imagesStatusTable_array[0].attrType;
				var imagesStatusTable_attr_Name = imagesStatusTable_array[0].attrName;


				var whereObjArray = eval('(' + imagesStatusTable_attr_value + ')');
				(function(imagesStatusTable_attr_id, imagesStatusTable_attr_value, imagesStatusTable_attr_Where,
					imagesStatusTable_attr_Type, imagesStatusTable_attr_Name, whereObjArray) {


					var table_data = new Array();;
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.status = whereObj_t.status;
						obj_t.icon = whereObj_t.icon;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + imagesStatusTable_attr_Type,
						toolbar: '<div style="float: left">' + imagesStatusTable_attr_Name +
							'</div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						done: function(res, curr, count) {
							//第一行是默认图片 设置不可编辑
							$('[lay-id=' + imagesStatusTable_attr_Type + ']').find(
								'tr[data-index="0"]').find('td').data('edit', false);
							//如果是异步请求数据方式，res即为你接口返回的信息。
							//如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
							//console.log(res);
							//得到当前页码
							//console.log(curr);
							//得到数据总量
							//console.log(count);

							//初始化表格里的原色选择块
							var selectTableSwitchArray = $('img[id^="selectTableImage_"]');
							$.each(selectTableSwitchArray, function(index, domEle) {
								$("#" + domEle.id).click(function(e) {
									var divSwitchElem = $(this);
									var tdElem = divSwitchElem.closest("td");
									var trElem = tdElem.closest("tr");
									var tableView = trElem.closest(
										".layui-table-view");
									// var jyzt_lay_id = tableView.attr("lay-id");//layui表格的id
									layer.open({
										title: '请选择图片<span style="color:#ff0000">(暂不支持GIF格式的图片)</span>',
										type: 2,
										area: ['850px', '410px'],
                    skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'imageStatusList.html',
										end: function(index, layero) {
											if (imageStatusUrl !==
												'') {
												table.cache[
														tableView
														.attr(
															"lay-id"
														)][
														trElem.data(
															"index")
													]['icon'] =
													imageStatusUrl;
												table.reload(
													tableView
													.attr(
														"lay-id"
													), {
														data: table
															.cache[
																tableView
																.attr(
																	"lay-id"
																)
															]
													});
												stageOper
													.setModuleAttr(
														moduleObject,
														imagesStatusTable_attr_Where,
														imagesStatusTable_attr_id,
														table.cache[
															tableView
															.attr(
																"lay-id"
															)]);
											}

										}

									});
								});
							});



						},
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[{
									field: 'status',
									align: 'center',
									width: 103,
									title: '状态值',
									edit: 'text'
								}, {
									field: 'icon',
									align: 'center',
									width: 104,
									title: '选择图片',
									toolbar: '#layuiTableImageSelect'
								}, {
									title: '操作',
									align: 'center',
									width: 70,
									toolbar: '#wherebar'
								}

							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + imagesStatusTable_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"status": "",
									"icon": "config/image_status/tupianqiehuan.jpg"

								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};
					});

					//监听行工具事件
					table.on('tool(' + imagesStatusTable_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							if (obj.tr.data('index') == 0) {
								layer.msg('该行是默认图片不可删除', {
									offset: 't',
									anim: 6,
									icon: 7
								});
								return;
							}
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});

									stageOper.setModuleAttr(moduleObject,
										imagesStatusTable_attr_Where,
										imagesStatusTable_attr_id, table.cache[tableView
											.attr("lay-id")]);

								}



								layer.close(index);
							});
						}
					});
					//这是监听可编辑的
					table.on('edit(' + imagesStatusTable_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, imagesStatusTable_attr_Where,
							imagesStatusTable_attr_id, table.cache[tableView.attr("lay-id")]);
					});


				})(imagesStatusTable_attr_id, imagesStatusTable_attr_value, imagesStatusTable_attr_Where,
					imagesStatusTable_attr_Type, imagesStatusTable_attr_Name, whereObjArray);





			}




			//点击事件初始化
			if (click_array.length > 0) {
				var click_attr_id = click_array[0].attrCode;
				var click_attr_value = click_array[0].attrValue;
				var click_attr_Where = click_array[0].attrWhere;
				var click_attr_Type = click_array[0].attrType;
				var click_attr_Name = click_array[0].attrName;
				var clickObjArray = eval('(' + click_attr_value + ')');
				(function(click_attr_id, click_attr_value, click_attr_Where, click_attr_Type, click_attr_Name,
					clickObjArray) {


					var table_data = new Array();
					for (var i = 0; i < clickObjArray.length; i++) {
						var clickObj_t = clickObjArray[i];
						var obj_t = {};
						obj_t.code = clickObj_t.code;
						obj_t.content = clickObj_t.content;
						table_data.push(obj_t);
					}


					table.render({
						elem: '#' + click_attr_Type,
						toolbar: '<div style="float: left">' + click_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[{
									field: 'selectClickType',
									align: 'center',
									width: 140,
									title: '触发类型',
									templet: '#selectClickType'
								},
								{
									field: 'content',
									align: 'center',
									width: 140,
									title: '触发内容',
									edit: 'text'
								}
							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + click_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//这是监听可编辑的
					// table.on('edit(' + click_attr_Type + ')', function(obj) {
					// 	//console.log(obj.tr.data("index"));//获取当前行索引
					// 	//data = obj.data //得到所在行所有键值
					// 	var trElem = obj.tr;
					// 	var tableView = trElem.closest(".layui-table-view");
					// 	stageOper.setModuleAttr(moduleObject, click_attr_Where, click_attr_id, table
					// 		.cache[tableView.attr("lay-id")]);
					// });
					//此有改动1月29日，新加的到2871行
					var contElem = $('.layui-table-view[lay-id=' + click_attr_Type + ']').find('td').eq(1);
					if (clickObjArray[0]['code'] == 3) {
						contElem.removeAttr('data-edit');
						var selectDrawsHtml =
							"<select name='selectDraws_select' lay-filter='selectDraws_select'>";
						selectDrawsHtml += '<option value="">请选择</option>';
						var draws = eval("initConfig.getDrawsMoudleData(" + localStorage.getItem(
							'editViewId') + ")");
						if (draws.length > 0) {
							$.each(draws, function(k, draw) {
								var selectStr = clickObjArray[0]['content'] == draw.id ?
									'selected' : '';
								selectDrawsHtml += "<option value='" + draw.id + "' " + selectStr +
									">" + draw.draw_name + "</option>";
							});
						}
						selectDrawsHtml += "</select>";
						contElem.find('.layui-table-cell').eq(0).html(selectDrawsHtml);
						form.render();
						moduleObject.attrs.clickMethodCall = "redirectDraw";
						// 添加图纸
						form.on('select(selectDraws_select)', function(drawObj) {
							table.cache[click_attr_Type][0]['content'] = drawObj.value;
							stageOper.setModuleAttr(moduleObject, click_attr_Where, click_attr_id,
								table.cache[click_attr_Type]);
						});

					} else {
						//这是监听可编辑的
						table.on('edit(' + click_attr_Type + ')', function(obj) {
							stageOper.setModuleAttr(moduleObject, click_attr_Where, click_attr_id,
								table.cache[click_attr_Type]);
						});
					}

					//这是监听下拉框改变
					form.on('select(selectClickType_select)', function(data) {
						var selectElem = $(data.elem);
						var tdElem = selectElem.closest("td");
						var trElem = tdElem.closest("tr");
						var tableView = trElem.closest(".layui-table-view");
						var jyzt_lay_id = tableView.attr("lay-id"); //layui表格的id
						table.cache[tableView.attr("lay-id")][trElem.data("index")]['code'] = data
							.value;

						/* var elem = $(data.elem);
						 var trElem = elem.parents('tr');
						 var tableData = table.cache['whereSelectTable'];
						 // 更新到表格的缓存数据中，才能在获得选中行等等其他的方法中得到更新之后的值
						 var nndg = trElem.data('index');
						 var nnc =elem.attr('name');
						 tableData[trElem.data('index')]['code'] = data.value;*/
						var contElem = $(data.elem).parents('tr').find('td').eq(1);
						if (data.value == 3) {
							contElem.removeAttr('data-edit').attr('data-off', true);
							var selectDrawsHtml =
								"<select name='selectDraws_select' lay-filter='selectDraws_select'>";
							selectDrawsHtml += '<option value="">请选择</option>';
							var draws = eval("initConfig.getDrawsMoudleData(" + localStorage
								.getItem('editViewId') + ")");
							if (draws.length > 0) {
								$.each(draws, function(k, draw) {
									selectDrawsHtml += "<option value='" + draw.id + "'>" +
										draw.draw_name + "</option>";
								});
							}
							selectDrawsHtml += "</select>";
							contElem.find('.layui-table-cell').eq(0).html(selectDrawsHtml);
							form.render();

							// 添加图纸
							moduleObject.attrs.clickMethodCall = "redirectDraw";
							form.on('select(selectDraws_select)', function(drawObj) {
								table.cache[jyzt_lay_id][0]['content'] = drawObj.value;
								//table.cache[jyzt_lay_id][0]=JSON.stringify(table.cache[jyzt_lay_id][0]);
								// console.log(table.cache[jyzt_lay_id]);
								// table.cache[jyzt_lay_id][0]={
								// 	"code":table.cache[jyzt_lay_id][0]['code'],
								// 	"content":table.cache[jyzt_lay_id][0]['content']
								// }
								// console.log(table.cache[jyzt_lay_id][0]);
								stageOper.setModuleAttr(moduleObject, click_attr_Where,
									click_attr_id, table.cache[jyzt_lay_id]);
							});
						} else {
							contElem.removeAttr('data-off').attr('data-edit', 'text');
							if (data.value == 2) {
								contElem.find('.layui-table-cell').eq(0).html("http://");
							} else if (data.value == 1) {
								contElem.find('.layui-table-cell').eq(0).html("");
							}
							moduleObject.attrs.clickMethodCall = "sendCmdWebSocket";
							//这是监听可编辑的
							table.on('edit(' + jyzt_lay_id + ')', function(obj) {
								stageOper.setModuleAttr(moduleObject, click_attr_Where,
									click_attr_id, table.cache[jyzt_lay_id]);
							});
						}

						stageOper.setModuleAttr(moduleObject, click_attr_Where, click_attr_id, table
							.cache[tableView.attr("lay-id")]);

					});
				})(click_attr_id, click_attr_value, click_attr_Where, click_attr_Type, click_attr_Name,
					clickObjArray);
			}


			// 脉冲信号配置
			// if (clickMcxh_array.length > 0) {
			// 	var clickMcxh_attr_id = clickMcxh_array[0].attrCode;
			// 	var clickMcxh_attr_value = clickMcxh_array[0].attrValue;
			// 	var clickMcxh_attr_Where = clickMcxh_array[0].attrWhere;
			// 	var clickMcxh_attr_Type = clickMcxh_array[0].attrType;
			// 	var clickMcxh_attr_Name = clickMcxh_array[0].attrName;
			// 	var clickMcxhObjArray = eval('(' + clickMcxh_attr_value + ')');
			// 	(function(clickMcxh_attr_id, clickMcxh_attr_value, clickMcxh_attr_Where, clickMcxh_attr_Type,
			// 		clickMcxh_attr_Name, clickMcxhObjArray) {


			// 		var table_data = new Array();
			// 		for (var i = 0; i < clickMcxhObjArray.length; i++) {
			// 			var clickObj_t = clickMcxhObjArray[i];
			// 			var obj_t = {};
			// 			obj_t.start = clickObj_t.start;
			// 			obj_t.time = clickObj_t.time;
			// 			obj_t.end = clickObj_t.end;
			// 			table_data.push(obj_t);
			// 		}


			// 		table.render({
			// 			elem: '#' + clickMcxh_attr_Type,
			// 			toolbar: '<div style="float: left">' + clickMcxh_attr_Name +
			// 				'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
			// 			defaultToolbar: [{
			// 				title: '保存条件配置',
			// 				layEvent: 'flowAnimationSaveButton',
			// 				icon: 'layui-icon-ok'
			// 			}],
			// 			even: true,
			// 			limit: Number.MAX_VALUE // 数据表格默认全部显示
			// 				,
			// 			data: table_data,
			// 			cols: [
			// 				[{
			// 					field: 'start',
			// 					align: 'center',
			// 					width: 86,
			// 					title: '先发',
			// 					edit: 'text'
			// 				}, {
			// 					field: 'time',
			// 					align: 'center',
			// 					width: 87,
			// 					title: '间隔(s)',
			// 					edit: 'text'
			// 				}, {
			// 					field: 'end',
			// 					align: 'center',
			// 					width: 86,
			// 					title: '再发',
			// 					edit: 'text'
			// 				}]
			// 			]
			// 		});


			// 		//头工具栏事件
			// 		table.on('toolbar(' + clickMcxh_attr_Type + ')', function(obj) {

			// 			switch (obj.event) {
			// 				case 'flowAnimationSaveButton':
			// 					layer.msg('保存成功', {
			// 						offset: 't',
			// 						anim: 6,
			// 						icon: 1
			// 					});
			// 					break;
			// 			};





			// 		});

			// 		//这是监听可编辑的
			// 		table.on('edit(' + clickMcxh_attr_Type + ')', function(obj) {
			// 			//console.log(obj.tr.data("index"));//获取当前行索引
			// 			//data = obj.data //得到所在行所有键值
			// 			var trElem = obj.tr;
			// 			var tableView = trElem.closest(".layui-table-view");
			// 			stageOper.setModuleAttr(moduleObject, clickMcxh_attr_Where,
			// 				clickMcxh_attr_id, table.cache[tableView.attr("lay-id")]);
			// 		});
			// 	})(clickMcxh_attr_id, clickMcxh_attr_value, clickMcxh_attr_Where, clickMcxh_attr_Type,
			// 		clickMcxh_attr_Name, clickMcxhObjArray);
			// }



			//旋转

			if (rotate_array.length > 0) {
				var rotate_attr_id = rotate_array[0].attrCode;
				var rotate_attr_value = rotate_array[0].attrValue;
				var rotate_attr_Where = rotate_array[0].attrWhere;
				var rotate_attr_Type = rotate_array[0].attrType;
				var rotate_attr_Name = rotate_array[0].attrName;
				var whereObjArray = eval('(' + rotate_attr_value + ')');
				(function(rotate_attr_id, rotate_attr_value, rotate_attr_Where, rotate_attr_Type,
					rotate_attr_Name, whereObjArray) {


					var table_data = new Array();;
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.devicecode = whereObj_t.devicecode;
						obj_t.devicename = whereObj_t.devicename;
						obj_t.min = whereObj_t.min;
						obj_t.max = whereObj_t.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + rotate_attr_Type,
						toolbar: '<div style="float: left">' + rotate_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[{
									field: 'device_Select',
									align: 'center',
									width: '45%',
									title: '选择数据点',
									templet: '#device_rotate_Select'
								}, {
									field: 'min',
									align: 'center',
									width: '18%',
									title: '小值(>=)',
									edit: 'text'
								}, {
									field: 'max',
									align: 'center',
									width: '18%',
									title: '大值(<=)',
									edit: 'text'
								}, {
									title: '操作',
									align: 'center',
									width: '20%',
									toolbar: '#wherebar'
								}

							]
						],
						done: function(res, curr, count) {
							//这是监听数据点文本框的改变
							$("input[name='device_rotate_Select_select']").bind("click",
								function() {
									var current_input = $(this);
									//var input_value = $(this).val(); // 当前文本框的值
									var input_value = $(this).attr("id"); // 当前文本框的值转移到ID上
									//测试操作代码
									//alert($(this).val());
									var $selectedvalue = $(this).val();
									layer.open({
										title: '请选择需要绑定的数据点<span style="color:#ff0000">(已过滤空设备和空分组)</span>',
										type: 2,
										area: ['820px', '700px'],
										skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'hardwareSelect.html?hardware_id=' +
											input_value,
										end: function(index, layero) {
											//   var hardware_id="";//当前选择的硬件传感器数据点的id
											//    var hardware_Text="";//当前选择的硬件传感器数据点的描述

											if (hardware_id !== '') {
												current_input.val(
													hardware_Text);

												var selectElem = current_input;
												var tdElem = selectElem.closest(
													"td");
												var trElem = tdElem.closest(
													"tr");
												var tableView = trElem.closest(
													".layui-table-view");
												var jyzt_lay_id = tableView
													.attr(
														"lay-id"); //layui表格的id
												table.cache[tableView.attr(
													"lay-id")][trElem.data(
													"index")][
													'devicecode'
												] = hardware_id;
												table.cache[tableView.attr(
														"lay-id")][trElem.data(
														"index")][
														'devicename'
													] =
													hardware_Text;

												stageOper.setModuleAttr(
													moduleObject,
													rotate_attr_Where,
													rotate_attr_id, table
													.cache[tableView.attr(
														"lay-id")]);

												hardware_id = "";
												hardware_Text = "";
											}

										}

									});

								});
						}
					});


					//头工具栏事件
					table.on('toolbar(' + rotate_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];
								tjzt_data.push({
									"devicecode": "",
									"devicename": "",
									"min": "",
									"max": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + rotate_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject, rotate_attr_Where,
										rotate_attr_id, table.cache[tableView.attr(
											"lay-id")]);

								}



								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + rotate_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, rotate_attr_Where, rotate_attr_id,
							table.cache[tableView.attr("lay-id")]);
					});







				})(rotate_attr_id, rotate_attr_value, rotate_attr_Where, rotate_attr_Type, rotate_attr_Name,
					whereObjArray);
			}

			//旋转新，包含顺时针旋转，逆时针旋转。
			if (rotate_array_new.length > 0) {
				var new_rotate_attr_id = rotate_array_new[0].attrCode;
				var new_rotate_attr_value = rotate_array_new[0].attrValue;
				var new_rotate_attr_Where = rotate_array_new[0].attrWhere;
				var new_rotate_attr_Type = rotate_array_new[0].attrType;
				var new_rotate_attr_Name = rotate_array_new[0].attrName;
				var new_whereObjArray = eval('(' + new_rotate_attr_value + ')');
				(function(new_rotate_attr_id, new_rotate_attr_value, new_rotate_attr_Where,
					new_rotate_attr_Type, new_rotate_attr_Name, new_whereObjArray) {


					var table_data = new Array();;
					for (var i = 0; i < new_whereObjArray.length; i++) {
						var whereObj_t = new_whereObjArray[i];
						var obj_t = {};
						obj_t.directionRotation = whereObj_t.directionRotation;
						obj_t.min = whereObj_t.min;
						obj_t.max = whereObj_t.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + new_rotate_attr_Type,
						toolbar: '<div style="float: left">' + new_rotate_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[{
									field: 'direction_Select',
									align: 'center',
									width: 116,
									title: '旋转效果',
									templet: '#directionRotationOption'
								}, {
									field: 'min',
									align: 'center',
									width: 50,
									title: '>=',
									edit: 'text'
								}, {
									field: 'max',
									align: 'center',
									width: 50,
									title: '<=',
									edit: 'text'
								}, {
									title: '操作',
									align: 'center',
									width: 60,
									toolbar: '#wherebar'
								}

							]
						]
					});


					//头工具栏事件
					table.on('toolbar(' + new_rotate_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];
								tjzt_data.push({
									"directionRotation": "",
									"min": "",
									"max": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + new_rotate_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject,
										new_rotate_attr_Where, new_rotate_attr_id, table
										.cache[tableView.attr("lay-id")]);

								}
								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + new_rotate_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, new_rotate_attr_Where,
							new_rotate_attr_id, table.cache[tableView.attr("lay-id")]);
					});
					//这是监听下拉框改变
					form.on('select(directionRotationOption_select)', function(data) {
						var selectElem = $(data.elem);
						var tdElem = selectElem.closest("td");
						var trElem = tdElem.closest("tr");
						var tableView = trElem.closest(".layui-table-view");
						var jyzt_lay_id = tableView.attr("lay-id"); //layui表格的id
						table.cache[tableView.attr("lay-id")][trElem.data("index")][
							'directionRotation'
						] = data.value;

						/* var elem = $(data.elem);
						 var trElem = elem.parents('tr');
						 var tableData = table.cache['whereSelectTable'];
						 // 更新到表格的缓存数据中，才能在获得选中行等等其他的方法中得到更新之后的值
						 var nndg = trElem.data('index');
						 var nnc =elem.attr('name');
						 tableData[trElem.data('index')]['code'] = data.value;*/

						stageOper.setModuleAttr(moduleObject, new_rotate_attr_Where,
							new_rotate_attr_id, table.cache[tableView.attr("lay-id")]);

					});

				})(new_rotate_attr_id, new_rotate_attr_value, new_rotate_attr_Where, new_rotate_attr_Type,
					new_rotate_attr_Name, new_whereObjArray);
			}



			// 隐藏

			if (hide_array.length > 0) {
				var hide_attr_id = hide_array[0].attrCode;
				var hide_attr_value = hide_array[0].attrValue;
				var hide_attr_Where = hide_array[0].attrWhere;
				var hide_attr_Type = hide_array[0].attrType;
				var hide_attr_Name = hide_array[0].attrName;
				var whereObjArray = eval('(' + hide_attr_value + ')');
				(function(hide_attr_id, hide_attr_value, hide_attr_Where, hide_attr_Type, hide_attr_Name,
					whereObjArray) {


					var table_data = new Array();;
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.devicecode = whereObj_t.devicecode;
						obj_t.devicename = whereObj_t.devicename;
						obj_t.min = whereObj_t.min;
						obj_t.max = whereObj_t.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + hide_attr_Type,
						toolbar: '<div style="float: left">' + hide_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[

								{
									field: 'device_Select',
									align: 'center',
									width: 110,
									title: '选择数据点',
									templet: '#device_hide_Select'
								},
								{
									field: 'min',
									align: 'center',
									width: 50,
									title: '>=',
									edit: 'text'
								},
								{
									field: 'max',
									align: 'center',
									width: 50,
									title: '<=',
									edit: 'text'
								},
								{
									title: '操作',
									align: 'center',
									width: 72,
									toolbar: '#wherebar'
								}

							]
						],
						done: function(res, curr, count) {
							//这是监听数据点文本框的改变
							$("input[name='device_hide_Select_select']").bind("click",
								function() {
									var current_input = $(this);
									//var input_value = $(this).val(); // 当前文本框的值
									var input_value = $(this).attr("id");
									//测试操作代码
									//alert($(this).val());
									var $selectedvalue = $(this).val();
									layer.open({
										title: '请选择需要绑定的数据点<span style="color:#ff0000">(已过滤空设备和空分组)</span>',
										type: 2,
										area: ['820px', '700px'],
										skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'hardwareSelect.html?hardware_id='+input_value,
										end: function(index, layero) {
											//   var hardware_id="";//当前选择的硬件传感器数据点的id
											//    var hardware_Text="";//当前选择的硬件传感器数据点的描述

											if (hardware_id !== '') {
												//current_input.val(hardware_id+"-"+hardware_Text);
												current_input.val(
													hardware_Text);

												var selectElem = current_input;
												var tdElem = selectElem.closest(
													"td");
												var trElem = tdElem.closest(
													"tr");
												var tableView = trElem.closest(
													".layui-table-view");
												var jyzt_lay_id = tableView
													.attr(
														"lay-id"); //layui表格的id
												table.cache[tableView.attr(
													"lay-id")][trElem.data(
													"index")][
													'devicecode'
												] = hardware_id;
												table.cache[tableView.attr(
														"lay-id")][trElem.data(
														"index")][
														'devicename'
													] =
													hardware_Text;

												stageOper.setModuleAttr(
													moduleObject,
													hide_attr_Where,
													hide_attr_id, table
													.cache[tableView.attr(
														"lay-id")]);

												hardware_id = "";
												hardware_Text = "";
											}

										}

									});

								});
						}
					});


					//头工具栏事件
					table.on('toolbar(' + hide_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"devicecode": "",
									"devicename": "",
									"min": "",
									"max": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + hide_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject, hide_attr_Where,
										hide_attr_id, table.cache[tableView.attr(
											"lay-id")]);

								}



								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + hide_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, hide_attr_Where, hide_attr_id, table
							.cache[tableView.attr("lay-id")]);
					});


				})(hide_attr_id, hide_attr_value, hide_attr_Where, hide_attr_Type, hide_attr_Name,
					whereObjArray);
			}
			// 闪烁
			if (sparkling_array.length > 0) {
				var sparkling_attr_id = sparkling_array[0].attrCode;
				var sparkling_attr_value = sparkling_array[0].attrValue;
				var sparkling_attr_Where = sparkling_array[0].attrWhere;
				var sparkling_attr_Type = sparkling_array[0].attrType;
				var sparkling_attr_Name = sparkling_array[0].attrName;
				var whereObjArray = eval('(' + sparkling_attr_value + ')');
				(function(sparkling_attr_id, sparkling_attr_value, sparkling_attr_Where, sparkling_attr_Type,
					sparkling_attr_Name, whereObjArray) {


					var table_data = new Array();
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.devicecode = whereObj_t.devicecode;
						obj_t.devicename = whereObj_t.devicename;
						obj_t.min = whereObj_t.min;
						obj_t.max = whereObj_t.max;
						table_data.push(obj_t);

					}


					table.render({
						elem: '#' + sparkling_attr_Type,
						toolbar: '<div style="float: left;">' + sparkling_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[

								{
									field: 'device_Select',
									align: 'center',
									width: 110,
									title: '选择数据点',
									templet: '#device_sparkling_Select'
								}, {
									field: 'min',
									align: 'center',
									width: 50,
									title: '>=',
									edit: 'text'
								}, {
									field: 'max',
									align: 'center',
									width: 50,
									title: '<=',
									edit: 'text'
								}, {
									title: '操作',
									align: 'center',
									width: 72,
									toolbar: '#wherebar'
								}

							]
						],
						done: function(res, curr, count) {
							//这是监听数据点文本框的改变
							$("input[name='device_sparkling_Select_select']").bind("click",
								function() {
									var current_input = $(this);
									//var input_value = $(this).val(); // 当前文本框的值
									var input_value = $(this).attr("id");
									//测试操作代码
									//alert($(this).val());
									var $selectedvalue = $(this).val();
									layer.open({
										title: '请选择需要绑定的数据点<span style="color:#ff0000">(已过滤空设备和空分组)</span>',
										type: 2,
										area: ['820px', '700px'],
										skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'hardwareSelect.html?hardware_id=' +
											input_value,
										end: function(index, layero) {
											//   var hardware_id="";//当前选择的硬件传感器数据点的id
											//    var hardware_Text="";//当前选择的硬件传感器数据点的描述

											if (hardware_id !== '') {
												current_input.val(
													hardware_Text);

												var selectElem = current_input;
												var tdElem = selectElem.closest(
													"td");
												var trElem = tdElem.closest(
													"tr");
												var tableView = trElem.closest(
													".layui-table-view");
												var jyzt_lay_id = tableView
													.attr(
														"lay-id"); //layui表格的id
												table.cache[tableView.attr(
													"lay-id")][trElem.data(
													"index")][
													'devicecode'
												] = hardware_id;
												table.cache[tableView.attr(
														"lay-id")][trElem.data(
														"index")][
														'devicename'
													] =
													hardware_Text;

												stageOper.setModuleAttr(
													moduleObject,
													sparkling_attr_Where,
													sparkling_attr_id, table
													.cache[tableView.attr(
														"lay-id")]);

												hardware_id = "";
												hardware_Text = "";
											}

										}

									});

								});
						}
					});


					//头工具栏事件
					table.on('toolbar(' + sparkling_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"devicecode": "",
									"devicename": "",
									"min": "",
									"max": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + sparkling_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject,
										sparkling_attr_Where, sparkling_attr_id, table
										.cache[tableView.attr("lay-id")]);

								}



								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + sparkling_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, sparkling_attr_Where,
							sparkling_attr_id, table.cache[tableView.attr("lay-id")]);
					});


				})(sparkling_attr_id, sparkling_attr_value, sparkling_attr_Where, sparkling_attr_Type,
					sparkling_attr_Name, whereObjArray);
			}
			// 绑定多个数据点
			if (dataKeyArrayTable_array.length > 0) {
				var dataKeyArrayTable_attr_id = dataKeyArrayTable_array[0].attrCode;
				var dataKeyArrayTable_attr_value = dataKeyArrayTable_array[0].attrValue;
				var dataKeyArrayTable_attr_Where = dataKeyArrayTable_array[0].attrWhere;
				var dataKeyArrayTable_attr_Type = dataKeyArrayTable_array[0].attrType;
				var dataKeyArrayTable_attr_Name = dataKeyArrayTable_array[0].attrName;
				var whereObjArray = eval(dataKeyArrayTable_attr_value);
				(function(dataKeyArrayTable_attr_id, dataKeyArrayTable_attr_value, dataKeyArrayTable_attr_Where,
					dataKeyArrayTable_attr_Type, dataKeyArrayTable_attr_Name, whereObjArray) {
					var table_data = new Array();
					for (var i = 0; i < whereObjArray.length; i++) {
						var whereObj_t = whereObjArray[i];
						var obj_t = {};
						obj_t.key = whereObj_t.key;
						obj_t.name = whereObj_t.name;
						table_data.push(obj_t);
					}
					table.render({
						elem: '#' + dataKeyArrayTable_attr_Type,
						toolbar: '<div style="float: left;">' + dataKeyArrayTable_attr_Name +
							'<span style="font-size:12px;color:red">(值为空该行无效)</span></div>',
						defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
							title: '添加条件',
							layEvent: 'addWhere',
							icon: 'layui-icon-add-1'
						}, {
							title: '保存条件配置',
							layEvent: 'flowAnimationSaveButton',
							icon: 'layui-icon-ok'
						}],
						even: true,
						limit: Number.MAX_VALUE // 数据表格默认全部显示
							,
						data: table_data,
						cols: [
							[

								{
									field: 'device_Select',
									align: 'center',
									width: 80,
									title: '选择',
									templet: '#device_KeyArrayTable_Select'
								}, {
									field: 'name',
									align: 'center',
									width: 146,
									title: '数据点名称',
									edit: 'text'
								}, {
									title: '操作',
									align: 'center',
									width: 56,
									toolbar: '#wherebar'
								}

							]
						],
						done: function(res, curr, count) {
							//这是监听数据点文本框的改变
							$("input[name='device_KeyArrayTable_Select_select']").bind("click",
								function() {
									var current_input = $(this);
									//var input_value = $(this).val(); // 当前文本框的值
									var input_value = $(this).attr("id");
									console.log(input_value);
									//测试操作代码
									//alert($(this).val());
									var $selectedvalue = $(this).val();
									layer.open({
										title: '请选择需要绑定的数据点<span style="color:#ff0000">(已过滤空设备和空分组)</span>',
										type: 2,
										area: ['820px', '700px'],
										skin: 'layer-class',
										fixed: false, //不固定
										maxmin: true,
										content: 'hardwareSelect.html?hardware_id=' +
											input_value,
										end: function(index, layero) {
											//   var hardware_id="";//当前选择的硬件传感器数据点的id
											//    var hardware_Text="";//当前选择的硬件传感器数据点的描述

											if (hardware_id !== '') {
												current_input.val(
												hardware_Text);

												var selectElem = current_input;
												var tdElem = selectElem.closest(
													"td");
												var trElem = tdElem.closest(
													"tr");
												var tableView = trElem.closest(
													".layui-table-view");
												var jyzt_lay_id = tableView
													.attr(
														"lay-id"); //layui表格的id

												table.cache[tableView.attr(
														"lay-id")][trElem.data(
														"index")]['key'] =
													hardware_id;
												table.cache[tableView.attr(
														"lay-id")][trElem.data(
														"index")]['name'] =
													hardware_Text;
												table.reload(jyzt_lay_id);
												stageOper.setModuleAttr(
													moduleObject,
													dataKeyArrayTable_attr_Where,
													dataKeyArrayTable_attr_id,
													table.cache[tableView
														.attr("lay-id")]);

												hardware_id = "";
												hardware_Text = "";
											}

										}

									});

								});
						}
					});


					//头工具栏事件
					table.on('toolbar(' + dataKeyArrayTable_attr_Type + ')', function(obj) {

						switch (obj.event) {
							case 'addWhere':
								var jyzt_table_id = obj.config.id;
								//var tjzt_data = obj.config.data;
								var tjzt_data = table.cache[jyzt_table_id];

								tjzt_data.push({
									"key": "",
									"name": ""
								});
								table.reload(jyzt_table_id, {
									data: tjzt_data
								});
								break;
							case 'flowAnimationSaveButton':
								layer.msg('保存成功', {
									offset: 't',
									anim: 6,
									icon: 1
								});
								break;
						};





					});

					//监听行工具事件
					table.on('tool(' + dataKeyArrayTable_attr_Type + ')', function(obj) {

						//console.log(obj)
						if (obj.event === 'delWhere') {
							layer.confirm('真的删除行么', {
								offset: 'r'
							}, function(index) {
								var trElem = obj.tr;
								var tableView = trElem.closest(".layui-table-view");
								var t_data = table.cache[tableView.attr("lay-id")];
								if (obj.tr.data('index') >= 0) {
									t_data.splice(obj.tr.data('index'), 1) //根据索引删除当前行
									table.reload(tableView.attr("lay-id"), {
										data: t_data
									});
									stageOper.setModuleAttr(moduleObject,
										dataKeyArrayTable_attr_Where,
										dataKeyArrayTable_attr_id, table.cache[tableView
											.attr("lay-id")]);

								}



								layer.close(index);
							});
						}
					});

					//这是监听可编辑的
					table.on('edit(' + dataKeyArrayTable_attr_Type + ')', function(obj) {
						//console.log(obj.tr.data("index"));//获取当前行索引
						//data = obj.data //得到所在行所有键值
						var trElem = obj.tr;
						var tableView = trElem.closest(".layui-table-view");
						stageOper.setModuleAttr(moduleObject, dataKeyArrayTable_attr_Where,
							dataKeyArrayTable_attr_id, table.cache[tableView.attr("lay-id")]);
					});


				})(dataKeyArrayTable_attr_id, dataKeyArrayTable_attr_value, dataKeyArrayTable_attr_Where,
					dataKeyArrayTable_attr_Type, dataKeyArrayTable_attr_Name, whereObjArray);
			}

			function getName(){
				switch(viewDataType){
					case 'data':
					    return '实时数据';
					case 'historyData':
					    return '历史数据';
					case 'historyTable':
					    return '历史报表';
					case 'historyChart':
					    return '历史曲线';
					case 'analysis':
					    return '数据分析';
          case 'statement':
              return '数据报表';
					case 'alarm':
					    return '报警记录';
					case 'log':
					    return '操作记录';
				    case 'device':
				        return '设备列表';
				}
			}

            //默认参数处理
			$("input[name='setDefault']").click(function(event) {
				var  areaHeight = 580;
				var  newTitle = getName();
				if(viewDataType=="data" || viewDataType=="alarm" || viewDataType=="log"){
					areaHeight=380;
				}else if(viewDataType.indexOf('history')>=0){
					//console.log("ok")
					areaHeight=480;
				}

            	event.stopPropagation();
            	layer.open({
            		title: '设置默认参数 | '+newTitle,
            		type: 2,
                skin: 'layer-class',
            		area: ['500px',areaHeight+'px'],
					//area:'500px',  //只设置宽度，高度自适应
            		fixed: false, //不固定
            		maxmin: true,
            		//content: 'uploadImage.html?userId='+userId,
            		content: "defaultArgments.html?viewDataType="+viewDataType,
            		end: function(index, layero) {
						//console.log(index);
						//var argment="";
						if(argments!==""){
							console.log(argments);
							//放入图纸Json字符串
							moduleObject.setAttr("defaultArgments", argments);
							//临时缓存用于保存前的临时查看
							sessionStorage.setItem("defaultArgments",argments);
							//这里不用回显
							// for (var j = 0; j < input_text_array.length; j++) {
							// 	var text_attr_id = input_text_array[j].attrCode + '_' + input_text_array[j].attrWhere.split(
							// 		",")[0];
							// 	var text_attr = input_text_array[j].attrCode;
							// 	var text_attr_value = input_text_array[j].attrValue;
							// 	var text_attr_Where = input_text_array[j].attrWhere;
							// }
							// (function(text_attr_id, text_attr, text_attr_value, text_attr_Where) {
							// 	stageOper.setModuleAttr(moduleObject, text_attr_Where, text_attr,
							// 			argments);

							// })(text_attr_id, text_attr, text_attr_value, text_attr_Where);
						}
            		}
                });

            });

		},
		/**
		 * 设置组件的属性
		 * @param moduleObject  组件对象
		 * attrWhere 组件里面的哪个形状
		 * attr 这个形状的哪个属性
		 * attrValue 这个属性值是多少
		 * showType 组件基础信息的时候使用
		 */
		setModuleAttr: function(moduleObject, attrWhereArr, attr, attrValue, showType) {

			var attrWhereArray = attrWhereArr.split(",");
			for (var i = 0; i < attrWhereArray.length; i++) {
				var attrWhere = attrWhereArray[i];




				var moudleShape;
				var moduleType = moduleObject.attrs.moduleType;


				if (attrWhere === 'this') {
					moudleShape = moduleObject;
				} else {
					moudleShape = moduleObject.findOne('.' + attrWhere);
				}
				if (attr == 'fill') {

				}
				if (attr == 'text') {
					//attrValue = attrValue==""?'-':attrValue;
					//不使用'-'占位，删除文字后无'-'占位；
					attrValue = attrValue == "" ? '' : attrValue;
				}

				if (attr == 'strokeWidth') {
					attrValue = parseFloat(attrValue);
				}

				if ('FLOWLINE' === moduleType && attr === 'strokeWidth') {

					var backgroundLineShape = moduleObject.findOne('.backgroundLine');
					var dynamicLineShape = moduleObject.findOne('.dynamicLine');
					backgroundLineShape.setAttr(attr, attrValue);
					dynamicLineShape.setAttr(attr, backgroundLineShape.attrs.strokeWidth / 5 * 4);
					dynamicLineShape.setAttr('dash', [backgroundLineShape.attrs.strokeWidth, backgroundLineShape
						.attrs.strokeWidth * 2
					]);



				} else if ('BASETABLE' === moduleType && attr === 'rowNum' ||
					'BASETABLE' === moduleType && attr === 'colNum' ||
					'BASETABLE' === moduleType && attr === 'cellWidth' ||
					'BASETABLE' === moduleType && attr === 'cellHeight'
				) {
					moudleShape.setAttr(attr, attrValue); //设置属性
					var descriptionobjRect = moduleObject.get('.descriptionRect')[0];
					var cellWidth = moduleObject.attrs.cellWidth; //单元格宽
					var cellHeight = moduleObject.attrs.cellHeight; //单元格高
					var rowNum = moduleObject.attrs.rowNum; //行
					var colNum = moduleObject.attrs.colNum; //列

					//---------------------------计算第一条线的坐标start----------------------------
					//计算表格左侧的坐标
					var tableLeftPoint = new Array();
					for (var i = 0; i <= rowNum; i++) {
						tableLeftPoint.push(0);
						tableLeftPoint.push(i * cellHeight);
					}
					//计算表格右侧的坐标
					var tableRightPoint = new Array();
					for (var i = 0; i <= rowNum; i++) {
						tableRightPoint.push(colNum * cellWidth);
						tableRightPoint.push(i * cellHeight);
					}
					//总结第一条横向的线段坐标
					var lingOne = new Array();
					var horizontalNumber = tableLeftPoint.length / 2;
					for (var i = 0; i < horizontalNumber; i++) {
						if (i % 2 == 0) {
							// 偶数
							lingOne.push(tableLeftPoint.shift());
							lingOne.push(tableLeftPoint.shift());
							lingOne.push(tableRightPoint.shift());
							lingOne.push(tableRightPoint.shift());
						} else {
							// 奇数

							lingOne.push(tableRightPoint.shift());
							lingOne.push(tableRightPoint.shift());
							lingOne.push(tableLeftPoint.shift());
							lingOne.push(tableLeftPoint.shift());
						}
					}
					//---------------------------计算第一条线的坐标end----------------------------

					//---------------------------计算第二条线的坐标start----------------------------
					//计算表格上侧的坐标
					var tableTopPoint = new Array();
					for (var i = 0; i <= colNum; i++) {
						tableTopPoint.push(i * cellWidth);
						tableTopPoint.push(0);
					}
					//计算表格下侧的坐标
					var tableBottomPoint = new Array();
					for (var i = 0; i <= colNum; i++) {
						tableBottomPoint.push(i * cellWidth);
						tableBottomPoint.push(rowNum * cellHeight);
					}
					//总结第二条纵向的线段坐标
					var lingTow = new Array();
					var verticalNumber = tableTopPoint.length / 2;
					for (var i = 0; i < verticalNumber; i++) {
						if (i % 2 == 0) {
							// 偶数
							lingTow.push(tableTopPoint.shift());
							lingTow.push(tableTopPoint.shift());
							lingTow.push(tableBottomPoint.shift());
							lingTow.push(tableBottomPoint.shift());
						} else {
							// 奇数
							lingTow.push(tableBottomPoint.shift());
							lingTow.push(tableBottomPoint.shift());
							lingTow.push(tableTopPoint.shift());
							lingTow.push(tableTopPoint.shift());

						}
					}
					//---------------------------计算第二条线的坐标end----------------------------
					//设置线的坐标
					var line1 = moduleObject.get('.line1')[0];
					var line2 = moduleObject.get('.line2')[0];
					line1.points(lingOne);
					line2.points(lingTow);
					//设置边框的宽高
					var borderWidth = colNum * cellWidth;
					var borderHeight = rowNum * cellHeight;
					var rectBackground = moduleObject.get('.rectBackground')[0];
					var rectBorder = moduleObject.get('.rectBorder')[0];

					rectBackground.width(borderWidth);
					rectBackground.height(borderHeight);
					rectBorder.width(borderWidth);
					rectBorder.height(borderHeight);

				} else if ('FLOWLINE' === moduleType && attr === 'where') {
					var attrV = new Array();
					for (var j = 0; j < attrValue.length; j++) {
						if (attrValue[j].code !== "" && attrValue[j].min !== "" && attrValue[j].max !== "") {
							var item_t = new Object();
							item_t.direction = attrValue[j].code;
							item_t.where = {
								min: attrValue[j].min,
								max: attrValue[j].max
							}
							attrV.push(item_t);
						}
					}
					moudleShape.setAttr(attr, JSON.stringify(attrV));

				} else if ('STATUSVALUE' === moduleType && attr === 'where') {
					var attrV = new Array();
					for (var j = 0; j < attrValue.length; j++) {
						if (attrValue[j].description !== "" && attrValue[j].min !== "" && attrValue[j].max !==
							"") {
							var item_t = new Object();
							item_t.description = attrValue[j].description;
							item_t.where = {
								min: attrValue[j].min,
								max: attrValue[j].max
							}
							attrV.push(item_t);
						}
					}
					moudleShape.setAttr(attr, JSON.stringify(attrV));

				} else if ('STATUSLIGHT' === moduleType && attr === 'where') {
					var attrV = new Array();
					for (var j = 0; j < attrValue.length; j++) {
						if (attrValue[j].color !== "" && attrValue[j].min !== "" && attrValue[j].max !== "") {
							var item_t = new Object();
							item_t.color = attrValue[j].color;
							item_t.where = {
								min: attrValue[j].min,
								max: attrValue[j].max
							}
							attrV.push(item_t);
						}
					}
					moudleShape.setAttr(attr, JSON.stringify(attrV));

				} else if ('BASELINE' === moduleType && attr === 'where') {
					var attrV = new Array();
					for (var j = 0; j < attrValue.length; j++) {
						if (attrValue[j].color !== "" && attrValue[j].min !== "" && attrValue[j].max !== "") {
							var item_t = new Object();
							item_t.color = attrValue[j].color;
							item_t.where = {
								min: attrValue[j].min,
								max: attrValue[j].max
							}
							attrV.push(item_t);
						}
					}
					moudleShape.setAttr(attr, JSON.stringify(attrV));

				} else if ('ELECTRIC' === moduleType && (attr === 'where' || attr === 'startOnOffState' ||
						attr === 'OnOffState')

				) {
					if (attr === 'where') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {
							if (attrValue[j].color !== "" && attrValue[j].min !== "" && attrValue[j].max !==
								"") {
								var item_t = new Object();
								item_t.color = attrValue[j].color;
								item_t.where = {
									min: attrValue[j].min,
									max: attrValue[j].max
								}
								attrV.push(item_t);
							}
						}
						moudleShape.setAttr(attr, JSON.stringify(attrV));
					}
					if (attr === 'OnOffState') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {
							if (attrValue[j].color !== "" && attrValue[j].min !== "" && attrValue[j].max !==
								"") {
								var item_t = new Object();
								item_t.color = attrValue[j].color;
								item_t.textState = attrValue[j].textState;
								item_t.where = {
									min: attrValue[j].min,
									max: attrValue[j].max
								}
								attrV.push(item_t);
							}
						}
						moudleShape.setAttr(attr, JSON.stringify(attrV));
					}

					if (attr === 'startOnOffState') { // 开合状态
						var khObj = moduleObject.find('.khys'); //找到开合元素
						var onoffXY = moduleObject.attrs.onoffXY; // 拿到开合坐标
						if (attrValue === '1') {
							khObj.points(onoffXY.on);

						} else if (attrValue === '0') {
							khObj.points(onoffXY.off);
						}


						moudleShape.setAttr(attr, attrValue);
					}

				} else if ('IMAGES_SWITCH' === moduleType && attr === 'where') {
					var attrV = new Array();
					var defaultIcon = '';
					for (var j = 0; j < attrValue.length; j++) {
						if (attrValue[j].status !== "" && attrValue[j].icon !== "") {
							var item_t = new Object();
							item_t.description = attrValue[j].description;
							item_t.status = attrValue[j].status;
							item_t.command = attrValue[j].command;
							item_t.icon = attrValue[j].icon;
							if (j == 0) {
								//来自我的图库
								if (item_t.icon.indexOf('http') == 0) {
									defaultIcon = item_t.icon;
								} else { //来自本地内置
									defaultIcon = item_t.icon.split("_")[0] + "." + item_t.icon.split(".")[
										1]; //设置默认图片
								}
							}
							attrV.push(item_t);
						}
					}
					moudleShape.setAttr(attr, JSON.stringify(attrV));
					moudleShape.setAttr("imageURL", defaultIcon);
					var nodes = moduleObject.find('Image');
					nodes.each(function(node) {
						node.destroy();
					});
					var urlImage = defaultIcon;
					Konva.Image.fromURL(urlImage, function(imageNode) {
						imageNode.name("myShape");
						imageNode.setAttr("offset", {
							x: imageNode.width() / 2,
							y: imageNode.height() / 2,
						});
						moduleObject.add(imageNode);
						stageOper.layer_three.get(".transformer")[0].nodes([moduleObject]);

						stageOper.layer_three.draw();
						stageOper.layer.draw();

					}, "config/gyyj/noimg.svg");

				} else if (('TextLableValue' === moduleType || "VALUE" === moduleType) && attr ===
					'valueZoomConfig') { // 值缩放
					var attrV = new Array();
					var defaultIcon = '';
					for (var j = 0; j < attrValue.length; j++) {
						if (attrValue[j].status !== "" && attrValue[j].icon !== "") {
							var item_t = new Object();
							item_t.zoomSize = attrValue[j].zoomSize;
							item_t.decimalDigits = attrValue[j].decimalDigits;
							attrV.push(item_t);
						}
					}
					moudleShape.setAttr(attr, JSON.stringify(attrV));
				} else if ('IMAGES_STATUS' === moduleType && attr === 'where') {
					var attrV = new Array();
					var defaultIcon = '';
					for (var j = 0; j < attrValue.length; j++) {
						if (attrValue[j].status !== "" && attrValue[j].icon !== "") {
							var item_t = new Object();

							item_t.status = attrValue[j].status;

							item_t.icon = attrValue[j].icon;



							if (attrValue[j].status == 'default') {

								moudleShape.setAttr("imageURL", attrValue[j].icon);
								var nodes = moduleObject.find('Image');
								nodes.each(function(node) {
									node.destroy();
								});
								var urlImage = attrValue[j].icon;
								if (urlImage.indexOf(".gif") == -1) {
									Konva.Image.fromURL(urlImage, function(imageNode) {
										imageNode.name("myShape");
										imageNode.setAttr("offset", {
											x: imageNode.width() / 2,
											y: imageNode.height() / 2
										});
										moduleObject.add(imageNode);
										stageOper.layer_three.get(".transformer")[0].nodes([
											moduleObject
										]);
										stageOper.layer_three.batchDraw();
										stageOper.layer.batchDraw();

									}, "config/gyyj/noimg.svg");
								} else {

									var canvas = document.createElement('canvas');
									var image;
									var statusIn = false;
									gifler(urlImage).frames(canvas, function(ctx, frame) {
										// update canvas size
										canvas.width = frame.width;
										canvas.height = frame.height;
										// update canvas that we are using for Konva.Image
										ctx.drawImage(frame.buffer, 0, 0);
										// redraw the layer
										stageOper.stage.draw();
										if (!statusIn) {
											image = new Konva.Image({
												image: canvas,
												offset: {
													x: canvas.width / 2,
													y: canvas.height / 2
												}
											});
											moduleObject.add(image);
											// stageOper.stackZfun();
											try {
												stageOper.layer_three.find(".transformer")[0].nodes([
													moduleObject
												]);
											} catch (e) {

											}
											statusIn = true;
										}



									});




								}
							}



							attrV.push(item_t);
						}








					}
					moudleShape.setAttr(attr, JSON.stringify(attrV));







				} else if ('SVG_Rotating' === moduleType && attr === 'imageURL') {
					var nodes = moduleObject.find('Image');
					nodes.each(function(node) {
						node.destroy();
					});
					var urlImage = attrValue;
					moudleShape.setAttr(attr, urlImage);
					if (urlImage.indexOf(".gif") == -1) {
						Konva.Image.fromURL(urlImage, function(imageNode) {
							imageNode.name("myShape");
							imageNode.setAttr("offset", {
								x: imageNode.width() / 2,
								y: imageNode.height() / 2
							});
							moduleObject.add(imageNode);
							stageOper.layer_three.get(".transformer")[0].nodes([moduleObject]);
							stageOper.layer_three.batchDraw();
							stageOper.layer.batchDraw();

						}, "config/gyyj/noimg.svg");
					} else {

						var canvas = document.createElement('canvas');
						var image;
						var statusIn = false;
						gifler(urlImage).frames(canvas, function(ctx, frame) {
								// update canvas size
								canvas.width = frame.width;
								canvas.height = frame.height;
								// update canvas that we are using for Konva.Image
								ctx.drawImage(frame.buffer, 0, 0);
								// redraw the layer
								stageOper.stage.draw();
								if (!statusIn) {
									image = new Konva.Image({
											image: canvas,
											offset: {
													x: canvas.width / 2,
													y: canvas.height / 2
												}
											});
											moduleObject.add(image);
										// stageOper.stackZfun();
										try {
											stageOper.layer_three.find(".transformer")[0].nodes([
												moduleObject
											]);
										} catch (e) {

										}
										statusIn = true;
									}
								});
						}
					} else if (attr === 'clickWhere') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {

							var item_t = new Object();
							item_t.code = attrValue[j].code;
							item_t.content = attrValue[j].content;
							attrV.push(item_t);

						}
						if (attrV.length > 0) {
							moudleShape.setAttr(attr, JSON.stringify(attrV));
						}


					} else if (attr === 'clickSignalsWhere') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {

							var item_t = new Object();
							item_t.start = attrValue[j].start;
							item_t.time = attrValue[j].time;
							item_t.end = attrValue[j].end;
							attrV.push(item_t);

						}
						if (attrV.length > 0) {
							moudleShape.setAttr(attr, JSON.stringify(attrV));
						}


					} else if (attr === 'basicInfo') { //基础信息处理
						var binfo = moudleShape.attrs.basicInfo;
						if (typeof(binfo) == "undefined") {
							moudleShape.attrs.basicInfo = {};
						}
						if (showType == 'zxfs') {
							binfo.showType = attrValue;
							moudleShape.setAttr(attr, binfo);
						}
						if (showType == 'closeType') {
							binfo.closeViewType = attrValue;
							moudleShape.setAttr(attr, binfo);
						}
						if (showType == 'zxnr') {
							var attrV = new Array();
							for (var j = 0; j < attrValue.length; j++) {
								if (attrValue[j].type == '3') { // 如果是时间就设置为 就把值设置为 ---，这样才满足下面的if
									attrValue[j].value = '---'
								}
								if (attrValue[j].title !== "" && attrValue[j].type !== "" && attrValue[j]
									.value !==
									"") {
									var item_t = new Object();
									var title = attrValue[j].title;
									var type = attrValue[j].type;
									var value = attrValue[j].value;
									var valuetemp = "";
									if (type == '1') {
										valuetemp = value;
									}
									if (type == '2') {
										var vobj = value;
										valuetemp = vobj;
									}
									if (type == '3') {
										valuetemp = "---";
									}
									if (type == '4') {
										var vobj = value;
										valuetemp = vobj;
									}
									if (type == '5') {
										var vobj = value;
										valuetemp = vobj;
									}



									item_t.title = title;
									item_t.type = type;
									item_t.value = valuetemp;
									attrV.push(item_t);
								}
							}
							binfo.showContent = attrV;
							moudleShape.setAttr(attr, binfo);
						}


					} else if (attr === 'clickInfo') { //点击弹框处理
						var cinfo = moudleShape.attrs.clickInfo;
						if (typeof(cinfo) == "undefined") {
							moudleShape.attrs.clickInfo = {};
						}

						if (showType == 'clickType') {
							cinfo.clickType = attrValue;
							moudleShape.setAttr(attr, cinfo);
						}
						if (showType == 'urlContent') {
							cinfo.urlContent = attrValue;
							moudleShape.setAttr(attr, cinfo);
						}
						if (showType == 'contentWidth') {
							cinfo.contentWidth = attrValue;
							moudleShape.setAttr(attr, cinfo);
						}
						if (showType == 'contentHeight') {
							cinfo.contentHeight = attrValue;
							moudleShape.setAttr(attr, cinfo);
						}



					} else if (attr === 'rotateWhere') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {
							if (attrValue[j].devicecode !== "" && attrValue[j].min !== "" && attrValue[j]
								.max !==
								"") {
								var item_t = new Object();
								item_t.devicecode = attrValue[j].devicecode;
								item_t.devicename = attrValue[j].devicename;
								item_t.min = attrValue[j].min;
								item_t.max = attrValue[j].max;
								attrV.push(item_t);
							}
						}
						moudleShape.setAttr(attr, JSON.stringify(attrV));

					} else if (attr === 'rotateWhereNew') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {
							if (attrValue[j].devicecode !== "" && attrValue[j].min !== "" && attrValue[j]
								.max !==
								"") {
								var item_t = new Object();
								item_t.directionRotation = attrValue[j].directionRotation;
								item_t.min = attrValue[j].min;
								item_t.max = attrValue[j].max;
								attrV.push(item_t);
							}
						}
						moudleShape.setAttr(attr, JSON.stringify(attrV));

					} else if (attr === 'hideWhere') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {
							if (attrValue[j].devicecode !== "" && attrValue[j].min !== "" && attrValue[j]
								.max !==
								"") {
								var item_t = new Object();
								item_t.devicecode = attrValue[j].devicecode;
								item_t.devicename = attrValue[j].devicename;
								item_t.min = attrValue[j].min;
								item_t.max = attrValue[j].max;
								attrV.push(item_t);
							}
						}
						moudleShape.setAttr(attr, JSON.stringify(attrV));

					} else if (attr === 'sparklingWhere') {
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {
							if (attrValue[j].devicecode !== "" && attrValue[j].min !== "" && attrValue[j]
								.max !==
								"") {
								var item_t = new Object();
								item_t.devicecode = attrValue[j].devicecode;
								item_t.devicename = attrValue[j].devicename;
								item_t.min = attrValue[j].min;
								item_t.max = attrValue[j].max;
								attrV.push(item_t);
							}
						}
						moudleShape.setAttr(attr, JSON.stringify(attrV));

					} else if (attr === 'dataKey') { // 多个数据点
						var attrV = new Array();
						for (var j = 0; j < attrValue.length; j++) {
							if (attrValue[j].key !== "" && attrValue[j].name !== "") {
								var item_t = new Object();
								item_t.key = attrValue[j].key;
								item_t.name = attrValue[j].name;
								attrV.push(item_t);
							}else{   //可以为空，用以清除绑定
								// var item_t = new Object();
								// item_t.key = '';
								// item_t.name = '';
								attrV.push({"key":'',"name":''});
							}
						}
						moudleShape.setAttr(attr, JSON.stringify(attrV));

					} else if (('TextLableValue' === moduleType && attr === "text") ||
						('TextLableValue' === moduleType && attr === "fontSize") ||
						('TextLableValue' === moduleType && attr === "padding")
						// ('TextLableValue' === moduleType && attr === "labelWidth") ||
						// ('TextLableValue' === moduleType && attr === "valueWidth")
						) {
							moudleShape.setAttr(attr, attrValue);
						    if(moduleObject.attrs.labelValueWidth=='auto' || !moduleObject.attrs.labelValueWidth){
								var moudleShapeDes = moduleObject.get('.description')[0];
								//描述外面的框
								var descriptionobjRect = moduleObject.get('.descriptionRect')[0];
								descriptionobjRect.width(moudleShapeDes.getWidth());
								descriptionobjRect.height(moudleShapeDes.getHeight());
								//值 xy设置
								var complexTextValue = moduleObject.get('.complexTextValue')[0];
								complexTextValue.x(moudleShapeDes.x() + moudleShapeDes.getWidth());
								complexTextValue.y(moudleShapeDes.y());
								//值的框 xy设置
								var rectValue = moduleObject.get('.rectValue')[0];
								rectValue.x(moudleShapeDes.x() + moudleShapeDes.getWidth());
								rectValue.y(moudleShapeDes.y());
								rectValue.width(complexTextValue.getWidth());
								rectValue.height(complexTextValue.getHeight());
							}
						} else if('TextLableValue' === moduleType && attr === "labelWidth"){
								moudleShape.setAttr(attr, attrValue);
							if(moduleObject.attrs.labelValueWidth=='set'){ //不可为0，或非数值
								//var labelWidth = Number(attrValue);
								var moudleShapeDes = moduleObject.get('.description')[0];
								var descriptionobjRect = moduleObject.get('.descriptionRect')[0];
								//文本框及内容区域宽度
								moudleShapeDes.width(Number(attrValue));
								descriptionobjRect.width(Number(attrValue));
								//值的框x设置
								var rectValue = moduleObject.get('.rectValue')[0];
								rectValue.x(moudleShapeDes.x() + Number(attrValue));
								//值内容X的值
								var complexTextValue = moduleObject.get('.complexTextValue')[0];
								complexTextValue.x(moudleShapeDes.x() + Number(attrValue));
							}

					}else if('TextLableValue' === moduleType && attr === "valueWidth"){
						if(moduleObject.attrs.labelValueWidth=='set'){  //不可为0，或非数值
						    //var valueWidth = Number(attrValue);
							//值的框宽度设置
							var rectValue = moduleObject.get('.rectValue')[0];
							rectValue.width(Number(attrValue));
							//值内容区宽度设置
							var complexTextValue = moduleObject.get('.complexTextValue')[0];
							complexTextValue.width(Number(attrValue));
							moudleShape.setAttr(attr, attrValue);
						}
					}else if (('lableText' === moduleType && attr === "text") ||
						('lableText' === moduleType && attr === "lineHeight") ||
						('lableText' === moduleType && attr === "padding") ||
						('lableText' === moduleType && attr === "fontSize")
					) {

						moudleShape.setAttr(attr, attrValue);
						var moudleShapeDes = moduleObject.get('.description')[0];
						//边框
						var text_border = moduleObject.get('.text_border')[0];
						text_border.width(moudleShapeDes.getWidth());
						text_border.height(moudleShapeDes.getHeight());

					} else if (('VALUE' === moduleType && attr === "text") ||
						('VALUE' === moduleType && attr === "padding") ||
						('VALUE' === moduleType && attr === "fontSize")
					) {

						moudleShape.setAttr(attr, attrValue);
						var moudleShapeDes = moduleObject.get('.complexTextValue')[0];
						//边框
						var text_border = moduleObject.get('.text_border')[0];
						text_border.width(moudleShapeDes.getWidth());
						text_border.height(moudleShapeDes.getHeight());

					} else if ('CURRENTDATE' === moduleType && attr === "dateFormat") {

						var CURRENTDATE_TEXT = moduleObject.get('.complexTextValue')[0];
						moduleObject.setAttr(attr, attrValue);
						CURRENTDATE_TEXT.setAttr("text", new Date().dateFormat(attrValue));



					} else if (('BUTTONVALUE' === moduleType && attr === "text") ||
						('BUTTONVALUE' === moduleType && attr === "padding") ||
						('BUTTONVALUE' === moduleType && attr === "fontSize") ||
						('BUTTON_JUMP' === moduleType && attr === "text") ||
						('BUTTON_JUMP' === moduleType && attr === "padding") ||
						('BUTTON_JUMP' === moduleType && attr === "fontSize") ||
						('BUTTON' === moduleType && attr === "text") ||
						('BUTTON' === moduleType && attr === "padding") ||
						('BUTTON' === moduleType && attr === "fontSize") ||
						('BUTTON_IMPULSES' === moduleType && attr === "text") ||
						('BUTTON_IMPULSES' === moduleType && attr === "padding") ||
						('BUTTON_IMPULSES' === moduleType && attr === "fontSize") ||
						('RESET' === moduleType && attr === "text") ||
						('RESET' === moduleType && attr === "padding") ||
						('RESET' === moduleType && attr === "fontSize")
					) {

						moudleShape.setAttr(attr, attrValue);
						var moudleShapeDes = moduleObject.get('.buttonText')[0];
						//描述外面的框
						var descriptionobjRect = moduleObject.get('.buttonRect')[0];
						descriptionobjRect.width(moudleShapeDes.getWidth());
						descriptionobjRect.height(moudleShapeDes.getHeight());
						if ('BUTTON' === moduleType  || 'BUTTONVALUE' === moduleType){
							if(moduleObject.attrs.btnImageUrl){
								var imageObj= new Image();
								imageObj.crossOrigin='Anonymous';
								imageObj.src=moduleObject.attrs.btnImageUrl;
								imageObj.onload=function(){
									descriptionobjRect.fillPatternRepeat('no-repeat');
									descriptionobjRect.fillPatternOffset({ x:0,y:0 });
									var w=descriptionobjRect.getWidth()/imageObj.width;
									var h=descriptionobjRect.getHeight()/imageObj.height;
									descriptionobjRect.fillPatternImage(imageObj);
									descriptionobjRect.fillPatternScale({x:w,y:h});
									descriptionobjRect.getLayer().draw();
								}
							}
              descriptionobjRect.setAttr("fillLinearGradientEndPoint", {
								x: 0,
								y: moudleShapeDes.getHeight()
							});
						}





					} else if(('BUTTON' === moduleType || 'BUTTONVALUE' ===moduleType) && attr === "btnImageUrl"){
             if(attrValue){
             	moudleShape.setAttr(attr, attrValue);
             	var moudleShapeDes = moduleObject.get('.buttonText')[0];
             	//描述外面的框
             	var descriptionobjRect = moduleObject.get('.buttonRect')[0];
             	descriptionobjRect.width(moudleShapeDes.getWidth());
             	descriptionobjRect.height(moudleShapeDes.getHeight());
             	if(attrValue!='config/gyyj/noimg.svg'){
             		var imageObj= new Image();
             		imageObj.crossOrigin='Anonymous';
             		imageObj.src=attrValue;
             		imageObj.onload=function(){
             			console.log(attrValue);
             			descriptionobjRect.fillPatternRepeat('no-repeat');
             			descriptionobjRect.fillPatternOffset({ x:0,y:0 });
             			var w=descriptionobjRect.getWidth()/imageObj.width;
             			var h=descriptionobjRect.getHeight()/imageObj.height;
             			descriptionobjRect.fillPatternImage(imageObj);
             			descriptionobjRect.fillPatternScale({x:w,y:h});
             			descriptionobjRect.getLayer().draw();
             		}

             	}else{
             		descriptionobjRect.fillPatternImage('');
             		moduleObject.attrs.btnImageUrl='';
             		moudleShape.setAttr(attr, '');
             		//descriptionobjRect.getLayer().draw();
             	}
             }
          }else if ('BASELINE' === moduleType && attr === 'strokeWidth') {
						if (attrValue < 2) {
							layer.msg('线段粗细不能小于2', {
								offset: 't',
								anim: 6,
								icon: 2
							});
						} else {
							moudleShape.setAttr(attr, attrValue);
						}

					} else {
						if (attr == 'cornerRadius') {
							moudleShape.setAttr(attr, parseInt(attrValue));
						} else if (attr == 'x' || attr == 'y') {
							moudleShape.setAttr(attr, parseFloat(attrValue));
						} else {
							moudleShape.setAttr(attr, attrValue);
							if (attr == "stroke" && moudleShape.attrs.isStrockColorTofill ==
								true) { //边框颜色变的时候，如果该元素的isStrockColorTofill=true 那么填充也要跟着边框一起变颜色
								moudleShape.setAttr('fill', attrValue);
							}
						}

					}


					if (moduleType == 'BASELINE') { //线段从新添加编辑效果
						this.addLineEdit(moduleObject);
					} else if (moduleType == 'FLOWLINE') { //线段从新添加编辑效果
						this.addFlowLineEdit(moduleObject);
					} else { //改变属性后重新设置变换框

						// setTimeout(function(){// 延迟渲染，应为如果是图片，当时还没有出来
						try {
							this.layer_three.get(".transformer")[0].nodes([moduleObject]);
						} catch (e) {

						}
						// },100);

					}
					this.layer.draw();
				}

				// 存入到撤销的数组
				// stackZ.push(stageOper.getStageJson());

			},

			/**
			给场景添加键盘事件，组件上下左右移动，复制组件
			 */
			setStageKeyboardEvent: function() {
					var container = this.stage.container();
					container.tabIndex = 1;
					container.focus();
					//container.addEventListener('keydown', function (e) {// 之前是对 container 做监听 这样鼠标如果在外面 container 没有获得焦点的时候无效
					container.addEventListener('keyup', function(
					e) { // 放开//后来对document进行监听 这样的话，在浏览器层面的快捷键如ctrl+v就不管用了
						lastkeyCode = -1;
						stageOper.stage.draggable(false);
						spaceIsDown = false;
						document.body.style.cursor = 'default';
					});
					container.addEventListener('keydown', function(e) { // 放开的时候执行可以避免某些问题

						if (event.keyCode == lastkeyCode) { // 判断长按，如果长按只处理一次
							//return;    //2022年5月26日改为支持长按
						}
						lastkeyCode = event.keyCode;


						var moduleArrayObj;
						try {
							moduleArrayObj = stageOper.layer_three.get(".transformer")[0].nodes();
						} catch (e) {
							moduleArrayObj = []
						}
						//---------ctrl+z Ctrl+Y 不能在循环里
						if (e.which === 90 && e.ctrlKey) { // 按 ctrl+z
							stageOper.topButtonFun('CtrlZ');
						} else if (e.which === 89 && e.ctrlKey) { // 按 ctrl+y
							stageOper.topButtonFun('CtrlY')
						} else if (e.altKey) { // 按 空格键 移动画布  现在在改为 按alt键，因为长按空格 滚动条会自动想下滚动
							stageOper.stage.draggable(true);
							document.body.style.cursor = 'all-scroll';
							spaceIsDown = true;
						} else if (e.which === 65 && e.ctrlKey) { // 按 ctrl+a 全选 不包括线段和流动条
							$("#zjsx").html(""); //清除属性面板
							var shapes = stageOper.stage.find('.jyzt_module_group').toArray();
							/* var moduleArrayType = shapes.filter(function(shape) {
							     return  shape.attrs.moduleType != "FLOWLINE" && shape.attrs.moduleType != "BASELINE" && shape.attrs.moduleType != "Arrow";
							 });*/

							var moduleArrayType = shapes;

							if (moduleArrayType.length == 1) { // 如果选框只有一个，要吧属性调出来
								stageOper.showModuleAttr(moduleArrayType[0]);
							}
							stageOper.layer_three.find(".transformer").destroy();
							var tr = new Konva.Transformer({
								name: "transformer",
								id: Math.uuid(),
								padding: 5,
								rotationSnaps: [0, 90, 180, 270],
							});

							tr.nodes(moduleArrayType);
							stageOper.layer_three.add(tr);
							stageOper.layer_three.draw();
						} else if (e.which === 83 && e.ctrlKey) { // 保存
							stageOper.stageMaxMin('restore'); //放大缩小后要还原
							var stageBase64 = stageOper.getStageBase64();
							stageOper.dealImage(stageBase64, 500, stageOper
								.callbackSaveStageAll); //压缩base64图片，压缩后会在回调方法调用保存
						} else if (e.which === 80 && e.ctrlKey) { // 预览
							stageOper.stageMaxMin('restore'); //放大缩小后要还原
							// window.open("preview.html", "_blank",
							// 	"toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes"
							// );
							//不要地址栏，2022年5月19日修改
							window.open("preview.html", "_blank",
								"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no"
							);
						} else {
							if (moduleArrayObj.length != 0) {
								if (e.which === 86 && e.ctrlKey) { // 如果是复制，复制之前先把transformerArrayTemp清空
									transformerArrayTemp = [];
                  sessionStorage.setItem("copyContent","");
								  sessionStorage.removeItem("copyContent");
                }
								if (e.which === 46) { // 按 删除
									stageOper.deleteModule();
									stageOper.stackZfun();
								} else {
									for (var i = 0; i < moduleArrayObj.length; i++) {

										var moduleObj = moduleArrayObj[i];
										if (e.which === 37) { // 按 左
											if (e.ctrlKey) {
												moduleObj.x(moduleObj.x() - 10);
											} else {
												moduleObj.x(moduleObj.x() - 1);
											}

										} else if (e.which === 38) { // 按 上

											if (e.ctrlKey) {
												moduleObj.y(moduleObj.y() - 10);
											} else {
												moduleObj.y(moduleObj.y() - 1);
											}

										} else if (e.which === 39) { // 按  右
											if (e.ctrlKey) {
												moduleObj.x(moduleObj.x() + 10);
											} else {
												moduleObj.x(moduleObj.x() + 1);
											}

										} else if (e.which === 40) { // 按 下
											if (e.ctrlKey) {
												moduleObj.y(moduleObj.y() + 10);
											} else {
												moduleObj.y(moduleObj.y() + 1);
											}

										} else if (e.which === 86 && e.ctrlKey) { // 按 ctrl+v
                       sessionStorage.setItem("copyContent","");
										    sessionStorage.removeItem("copyContent");
											var moduleObj_copy = moduleObj.toJSON();
											var module_t = stageOper.addModuleToStage(moduleObj_copy, {
												x: moduleObj.x() + 10,
												y: moduleObj.y() + 10
											}, true, i, moduleArrayObj.length - 1);
											//如果是复制的 ，讲 放到数组 然后把这些放到编辑框
											transformerArrayTemp.push(module_t);
										} else if(e.which === 67 && e.ctrlKey){  //ctrl+C  跨图纸复制
										    sessionStorage.removeItem("copyContent");
											//因为是跨图纸，所以必须使用本地存储
											sessionStorage.setItem("copyContent",JSON.stringify(moduleArrayObj));
										}else {
											return;
										}

									}
									if (e.which === 86 && e.ctrlKey) { // 如果是复制，复制之后的组件要放进编辑框

										$("#zjsx").html(""); //清除属性面板

										setTimeout(function() { // 延迟渲染，应为如果是图片，当时还没有出来 这个时候存入到撤销数组时就差图片导致撤销不成功
											stageOper.layer_three.find(".transformer")
										.destroy();
											stageOper.stackZfun();
											var tr = new Konva.Transformer({
												name: "transformer",
												id: Math.uuid(),
												padding: 5,
												rotationSnaps: [0, 90, 180, 270],
											});
											tr.nodes(transformerArrayTemp);
											stageOper.layer_three.add(tr);
											stageOper.layer_three.draw();
											//给元素添加变化结束事件
											tr.nodes().forEach(function(node) {
												node.off('transformend');
											});
											tr.nodes()[0].on('transformend', function() {
												console.log('transform end');
												stageOper.stackZfun();
												tr = new Konva.Transformer({
													name: "transformer",
													id: Math.uuid(),
													padding: 5,
													rotationSnaps: [0, 90, 180,
														270
													],
												});
												stageOper.layer_three.add(tr);
												tr.nodes(transformerArrayTemp);
											});

										}, 50); // 延迟后保存图片和gif都已经加载完成

									}
								}
							} else {
							    if(sessionStorage.getItem("copyContent")){
							    	if(e.which === 86 && e.ctrlKey){ // 跨图纸复制后的粘贴ctrl+v
							    		let  transformerArray = [];
							    		var  moduleCopyObj=JSON.parse(sessionStorage.getItem("copyContent"));
							    		//若果是单个的流动条或线段要转两次
							    		var  moduleCopyOne = null;
							    		try{
							    		    moduleCopyOne = JSON.parse(moduleCopyObj);
							    	    }catch(e){

							    		}
							    		//判断不是单个的流动条或线段
							    		if (moduleCopyObj.length && !moduleCopyOne) {
							    		    for (let i = 0; i < moduleCopyObj.length; i++) {
							    				let moduleObj_copy = moduleCopyObj[i];
							    				let oneItem =JSON.parse(moduleCopyObj[i]);
							    				//console.log(oneItem);
							    				let module_t = stageOper.addModuleToStage(moduleObj_copy, {
							    					x: oneItem.attrs.x,
							    					y: oneItem.attrs.y
							    				}, true,i, moduleCopyObj.length - 1);
							    				//如果是复制的 ，讲 放到数组 然后把这些放到编辑框
							    				transformerArray.push(module_t);
							    			}

							    			$("#zjsx").html(""); //清除属性面板

							    			setTimeout(function() { // 延迟渲染，应为如果是图片，当时还没有出来 这个时候存入到撤销数组时就差图片导致撤销不成功
							    				stageOper.layer_three.find(".transformer")
							    			.destroy();
							    				stageOper.stackZfun();
							    				var tr = new Konva.Transformer({
							    					name: "transformer",
							    					id: Math.uuid(),
							    					padding: 5,
							    					rotationSnaps: [0, 90, 180, 270],
							    				});
							    				tr.nodes(transformerArray);
							    				stageOper.layer_three.add(tr);
							    				stageOper.layer_three.draw();
							    				//给元素添加变化结束事件
							    				tr.nodes().forEach(function(node) {
							    					node.off('transformend');
							    				});
							    				tr.nodes()[0].on('transformend', function() {
							    					console.log('transform end');
							    					stageOper.stackZfun();
							    					tr = new Konva.Transformer({
							    						name: "transformer",
							    						id: Math.uuid(),
							    						padding: 5,
							    						rotationSnaps: [0, 90, 180,
							    							270
							    						],
							    					});
							    					stageOper.layer_three.add(tr);
							    					tr.nodes(transformerArray);
							    				});

							    			}, 100); // 延迟后保存图片和gif都已经加载完成
							    		}else{
							    			//处理单个线段和流动条的跨图纸复制
							    			var moduleType = moduleCopyOne.attrs.moduleType;
							    			//console.log(moduleType);
							    			var moduleObj_copy = JSON.stringify(moduleCopyOne);
							    			var tempModuleObject = stageOper.addModuleToStage(moduleObj_copy, {
							    				x: moduleCopyOne.attrs.x,
							    				y: moduleCopyOne.attrs.y
							    			}, true);

							    			currentModule = tempModuleObject;
							    			$("#zjsx").html(""); //清除属性面板
											//单个就把属性显示出来
							    			stageOper.showModuleAttr(currentModule);// 设置最新的属性面板
							    			stageOper.stackZfun();
							    			if (moduleType == 'BASELINE') {
							    				stageOper.addLineEdit(currentModule);
							    			}else if (moduleType == 'FLOWLINE') {
							    				stageOper.addFlowLineEdit(currentModule);
							    			}else{
												setTimeout(function() {
													stageOper.layer_three.find(".transformer")
													.destroy();
														stageOper.stackZfun();
														var tr = new Konva.Transformer({
															name: "transformer",
															id: Math.uuid(),
															padding: 5,
															rotationSnaps: [0, 90, 180, 270],
														});
														tr.nodes([currentModule]);
														stageOper.layer_three.add(tr);
														stageOper.layer_three.draw();
														//给元素添加变化结束事件
														tr.nodes().forEach(function(node) {
															node.off('transformend');
														});
														tr.nodes()[0].on('transformend', function() {
															console.log('transform end');
															stageOper.stackZfun();
															tr = new Konva.Transformer({
																name: "transformer",
																id: Math.uuid(),
																padding: 5,
																rotationSnaps: [0, 90, 180,
																	270
																],
															});
															stageOper.layer_three.add(tr);
															tr.nodes([currentModule]);
														});

												},100)
											}
							    		}
                      sessionStorage.setItem("copyContent","");
							    		sessionStorage.removeItem("copyContent");
							    		return
							    	}
							    }
								//对线段的处理
								var moduleObj = currentModule;

								if (typeof(moduleObj) == "undefined") {
									return;
								}
								if (e.which === 37) { // 按 左
									if (e.ctrlKey) {
										moduleObj.x(moduleObj.x() - 10);
									} else {
										moduleObj.x(moduleObj.x() - 1);
									}

								} else if (e.which === 38) { // 按 上
									if (e.ctrlKey) {
										moduleObj.y(moduleObj.y() - 10);
									} else {
										moduleObj.y(moduleObj.y() - 1);
									}

								} else if (e.which === 39) { // 按  右
									if (e.ctrlKey) {
										moduleObj.x(moduleObj.x() + 10);
									} else {
										moduleObj.x(moduleObj.x() + 1);
									}

								} else if (e.which === 40) { // 按 下
									if (e.ctrlKey) {
										moduleObj.y(moduleObj.y() + 10);
									} else {
										moduleObj.y(moduleObj.y() + 1);
									}

								} else if (e.which === 46) { // 按 删除
									stageOper.deleteModule(moduleObj);
									stageOper.stackZfun();
								} else if (e.which === 86 && e.ctrlKey) { // 按 00
                                    var moduleType = moduleObj.attrs.moduleType;
									if (moduleType == 'BASELINE') {
										stageOper.removeLineEdit(moduleObj);
									}
									if (moduleType == 'FLOWLINE') {
										stageOper.removeFlowLineEdit(moduleObj);
									}

									var moduleObj_copy = moduleObj.toJSON();
									var tempModuleObject = stageOper.addModuleToStage(moduleObj_copy, {
										x: moduleObj.x() + 10,
										y: moduleObj.y() + 10
									}, true);

									currentModule = tempModuleObject;
									$("#zjsx").html(""); //清除属性面板
									//stageOper.showModuleAttr(currentModule);// 设置最新的属性面板   ctrl+v的复制不让显示属性 如果长按的话会影响复制的效率

									stageOper.stackZfun();
									if (moduleType == 'BASELINE') {
										stageOper.addLineEdit(currentModule);
									}
									if (moduleType == 'FLOWLINE') {
										stageOper.addFlowLineEdit(currentModule);
									}
                                }  else if(e.which === 67 && e.ctrlKey){
									sessionStorage.removeItem("copyContent");
									//因为是跨图纸，所以必须使用本地存储
									//console.log(moduleObj);
									//console.log(JSON.stringify(moduleObj));
									sessionStorage.setItem("copyContent",JSON.stringify(moduleObj));
								}else {
									return;
								}
							}
						}



						e.preventDefault();
						stageOper.layer.batchDraw();

					});

				},
				/**
				 处理顶部的按钮功能
				 */
				topButtonFun: function(buttonType) {
					if ('CtrlZ' == buttonType) {
						try {
							$("#zjsx").html(""); //清除属性面板
							currentModule = undefined;
							this.layer_three.find(".transformer")[0].destroy();
							this.layer_three.draw();
						} catch (e) {

						}
						this.ctrlZ();
						return;
					} else if ('CtrlY' == buttonType) {
						try {
							$("#zjsx").html(""); //清除属性面板
							currentModule = undefined;
							this.layer_three.find(".transformer")[0].destroy();
							this.layer_three.draw();
						} catch (e) {

						}
						this.ctrlY();
						return;
					} else {
						var moduleArrayObj;
						try {
							moduleArrayObj = stageOper.layer_three.get(".transformer")[0].nodes();
						} catch (e) {
							moduleArrayObj = []
						}


						if (moduleArrayObj.length != 0) {
							if ('copy' == buttonType) { // 如果是复制，复制之前先把transformerArrayTemp清空
								transformerArrayTemp = [];
							}
							if ('copyOut' == buttonType) { // 如果是复制，复制之前先把transformerArrayTemp清空
								sessionStorage.removeItem("copyContent");
								sessionStorage.setItem("copyContent",JSON.stringify(moduleArrayObj));
							}
							if ('delete' == buttonType) {
								stageOper.deleteModule();
							} else {
								for (var i = 0; i < moduleArrayObj.length; i++) {
									var moduleObj = moduleArrayObj[i];
									if ('copy' == buttonType) {
										var moduleObj_copy = moduleObj.toJSON();
										var module_t = stageOper.addModuleToStage(moduleObj_copy, {
											x: moduleObj.x() + 10,
											y: moduleObj.y() + 10
										}, true);
										//如果是复制的 ，讲 放到数组 然后把这些放到编辑框
										transformerArrayTemp.push(module_t);
									}
									if ('up' == buttonType) {
										moduleObj.moveUp();
									}
									if ('down' == buttonType) {
										moduleObj.moveDown();
									}
									if ('top' == buttonType) {
										moduleObj.moveToTop();
									}
									if ('bottom' == buttonType) {
										moduleObj.moveToBottom();
									}
								}
								if ('copy' == buttonType) { // 如果是复制，复制之后的组件要放进编辑框

									setTimeout(function() { // 延迟渲染，应为如果是图片，当时还没有出来
										stageOper.layer_three.find(".transformer").destroy();
										stageOper.stackZfun();

										var tr = new Konva.Transformer({
											name: "transformer",
											id: Math.uuid(),
											padding: 5,
											rotationSnaps: [0, 90, 180, 270],
										});
										tr.nodes(transformerArrayTemp);
										stageOper.layer_three.add(tr);
										stageOper.layer_three.draw();

										$("#zjsx").html(""); //清除属性面板
										if (transformerArrayTemp.length == 1) { // 如果选框只有一个，要吧属性调出来
											stageOper.showModuleAttr(transformerArrayTemp[0]);
										}

									}, 10);

								}
							}

						} else {
							// 跨图纸复制后的图标按钮粘贴
							if ('copy' == buttonType && sessionStorage.getItem("copyContent")) {
								    let transformerArray = [];
									let  moduleArrayObj=JSON.parse(sessionStorage.getItem("copyContent"));
									//若果是单个的流动条或线段要转两次
									//console.log(moduleArrayObj);
									var   moduleCopyOne = null;
									try{
									    moduleCopyOne = JSON.parse(moduleArrayObj);
									}catch(e){

									}
									//判断是否单个流动条或线段
									if( moduleArrayObj.length && !moduleCopyOne){
										//console.log(moduleArrayObj)
										for (let i = 0; i < moduleArrayObj.length; i++) {
											let moduleObj_copy = moduleArrayObj[i];
											let oneItem = JSON.parse(moduleArrayObj[i]);
											//console.log(oneItem);
											let module_t = stageOper.addModuleToStage(moduleObj_copy, {
												x: oneItem.attrs.x,
												y: oneItem.attrs.y
											}, true,i, moduleArrayObj.length - 1);
											//如果是复制的 ，讲 放到数组 然后把这些放到编辑框
											transformerArray.push(module_t);
										}

										$("#zjsx").html(""); //清除属性面板

										setTimeout(function() { // 延迟渲染，应为如果是图片，当时还没有出来 这个时候存入到撤销数组时就差图片导致撤销不成功
											stageOper.layer_three.find(".transformer")
										.destroy();
											stageOper.stackZfun();
											var tr = new Konva.Transformer({
												name: "transformer",
												id: Math.uuid(),
												padding: 5,
												rotationSnaps: [0, 90, 180, 270],
											});
											tr.nodes(transformerArray);
											stageOper.layer_three.add(tr);
											stageOper.layer_three.draw();
											//给元素添加变化结束事件
											tr.nodes().forEach(function(node) {
												node.off('transformend');
											});
											tr.nodes()[0].on('transformend', function() {
												console.log('transform end');
												stageOper.stackZfun();
												tr = new Konva.Transformer({
													name: "transformer",
													id: Math.uuid(),
													padding: 5,
													rotationSnaps: [0, 90, 180,
														270
													],
												});
												stageOper.layer_three.add(tr);
												tr.nodes(transformerArray);
											});

										}, 100); // 延迟后保存图片和gif都已经加载完成
									}else{
										//处理单个线段和流动条的跨图纸复制
										var moduleType = moduleCopyOne.attrs.moduleType;
										console.log(moduleType);
										var moduleObj_copy = JSON.stringify(moduleCopyOne);
										var tempModuleObject = stageOper.addModuleToStage(moduleObj_copy, {
											x: moduleCopyOne.attrs.x,
											y: moduleCopyOne.attrs.y
										}, true);

										currentModule = tempModuleObject;
										$("#zjsx").html(""); //清除属性面板
										//单个就把属性显示出来
										stageOper.showModuleAttr(currentModule);// 设置最新的属性面板率
										stageOper.stackZfun();
										if (moduleType == 'BASELINE') {
											stageOper.addLineEdit(currentModule);
										} else if (moduleType == 'FLOWLINE') {
											stageOper.addFlowLineEdit(currentModule);
										}else{
											setTimeout(function() {
												stageOper.layer_three.find(".transformer")
												.destroy();
													stageOper.stackZfun();
													var tr = new Konva.Transformer({
														name: "transformer",
														id: Math.uuid(),
														padding: 5,
														rotationSnaps: [0, 90, 180, 270],
													});
													tr.nodes([currentModule]);
													stageOper.layer_three.add(tr);
													stageOper.layer_three.draw();
													//给元素添加变化结束事件
													tr.nodes().forEach(function(node) {
														node.off('transformend');
													});
													tr.nodes()[0].on('transformend', function() {
														console.log('transform end');
														stageOper.stackZfun();
														tr = new Konva.Transformer({
															name: "transformer",
															id: Math.uuid(),
															padding: 5,
															rotationSnaps: [0, 90, 180,
																270
															],
														});
														stageOper.layer_three.add(tr);
														tr.nodes([currentModule]);
													});

											},100)
										}
									}
                  sessionStorage.setItem("copyContent","");
									sessionStorage.removeItem("copyContent");
									return

							}
							//对线段的处理
							var moduleObj = currentModule;
							if (typeof(moduleObj) == "undefined") {
								return;
							}
							if (moduleObj.attrs.name != "layer_grid") { // 选择到背景，不让处理
								if ('copy' == buttonType) {

									var moduleType = moduleObj.attrs.moduleType;
									if (moduleType == 'BASELINE') {
										stageOper.removeLineEdit(moduleObj);
									}
									if (moduleType == 'FLOWLINE') {
										stageOper.removeFlowLineEdit(moduleObj);
									}
									var moduleObj_copy = moduleObj.toJSON();
									var tempModuleObject = stageOper.addModuleToStage(moduleObj_copy, {
										x: moduleObj.x() + 10,
										y: moduleObj.y() + 10
									}, true);

									currentModule = tempModuleObject;
									$("#zjsx").html(""); //清除属性面板
									stageOper.showModuleAttr(currentModule); // 设置最新的属性面板
									stageOper.stackZfun();
									if (moduleType == 'BASELINE') {
										stageOper.addLineEdit(currentModule);
									}
									if (moduleType == 'FLOWLINE') {
										stageOper.addFlowLineEdit(currentModule);
									}

								}
								if ('copyOut' == buttonType) { // 如果是跨图纸复制，复制之前先把缓存清空
									sessionStorage.removeItem("copyContent");
									sessionStorage.setItem("copyContent",JSON.stringify(moduleObj));
								}
								if ('delete' == buttonType) {
									stageOper.deleteModule(moduleObj);
								}
								if ('up' == buttonType) {
									moduleObj.moveUp();
								}
								if ('down' == buttonType) {
									moduleObj.moveDown();
								}
								if ('top' == buttonType) {
									moduleObj.moveToTop();
								}
								if ('bottom' == buttonType) {
									moduleObj.moveToBottom();
								}


							}
						}
					}
					this.stage.draw();


				},
				ctrlZ: function() {


					var p = stackZ.pop();
					if (p) {
						var nnc = stageOper.getStageJson();
						if (p == stageOper.getStageJson()) {
							if (stackZ.size() == 0) {
								stackZ.push(p);
								return;
							}
							stackY.push(p);
							if (stackY.size() >= 10) {
								stackY.shift();
							}
							this.ctrlZ();

						} else {

							/*  if(stackZ.size()==0){
							      stackZ.push(p);
							  }*/
							stackZ.push(p);
							this.initStage(undefined, undefined, p);


						}
					}

				},
				ctrlY: function() {
					var p = stackY.pop();

					if (p) {
						if (p == stageOper.getStageJson()) {
							if (stackY.size() == 0) {
								stackY.push(p);
								return;
							}
							this.ctrlY();

						} else {

							/*  if(stackZ.size()==0){
							 stackZ.push(p);
							 }*/
							stackY.push(p);
							this.initStage(undefined, undefined, p);
							// stackZ.push(p);
							stackZ.push(p);
						}
					}


				},

				/**
				 * 场景放大缩小，还原
				 */
				stageMaxMin: function(type) {

					var xtype = 1;
					var ytype = 1;
					if (type == "max") {
						xtype = this.stage.scale().x + 0.05;
						ytype = this.stage.scale().y + 0.05;
						/* layer.msg('放大或缩小状态下不可以框选组件', {
						     offset: '48px',
						     anim: 6,
						     icon:4
						 });*/

					}
					if (type == "min") {
						xtype = this.stage.scale().x - 0.05;
						ytype = this.stage.scale().y - 0.05;
						/* layer.msg('放大或缩小状态下不可以框选组件', {
						     offset: '48px',
						     anim: 6,
						     icon:4
						 });*/
					}
					if (type == "restore" || xtype == 1) {
						this.stage.position({
							x: 0,
							y: 0
						}); //回复场景原来的位置
						this.stage.draggable(false);
					}
					/* var layer_background = this.stage.findOne('.layer_background');//背景也要设置，这样才知道原始的场景大小有多大，有个参照
					 layer_background.scale({
					     x: xtype,
					     y: xtype
					 });*/
					this.stage.scale({
						x: xtype,
						y: xtype
					});
					this.stage.draw();
					$("#stageProportion").val(parseInt(xtype * 100) + "%");




				},
				//添加鼠标滚轮事件
				addMouseListens: function(stageO) {
					var container = stageO.container();
					//给页面绑定滑轮滚动事件
					if (document.addEventListener) { //firefox
						container.addEventListener('DOMMouseScroll', this.scrollFunc, false);
					}
					container.onmousewheel = container.onmousewheel = this.scrollFunc;


				},
				scrollFunc: function(e) {
					e.preventDefault();
					e = e || window.event;
					//if (e.wheelDelta && e.ctrlKey) { //判断浏览器IE，谷歌滑轮事件
					if (e.wheelDelta) { //判断浏览器IE，谷歌滑轮事件
						if (e.wheelDelta > 0) { //当滑轮向上滚动时
							stageOper.stageMaxMin('max');
						}
						if (e.wheelDelta < 0) { //当滑轮向下滚动时
							stageOper.stageMaxMin('min');
						}
						//} else if (e.detail && e.ctrlKey) { //Firefox滑轮事件
					} else if (e.detail) { //Firefox滑轮事件
						if (e.detail > 0) { //当滑轮向上滚动时
							stageOper.stageMaxMin('max');
						}
						if (e.detail < 0) { //当滑轮向下滚动时
							stageOper.stageMaxMin('min');
						}
					}
				},
				/* 得到当前画面所有需要吸附的目标锚点
				 */
				getAnchorArray: function() {
					var targetArray = new Array(); //相对位置目标锚点集合
					var absoluteTargetArray = new Array(); //绝对位置目标锚点集合
					this.stage.find('.anchor_adsorb').forEach(function(anchorTemp) {
						targetArray.push({
							x: anchorTemp.x(),
							y: anchorTemp.y()
						});
						absoluteTargetArray.push({
							x: anchorTemp.absolutePosition().x,
							y: anchorTemp.absolutePosition().y
						});
					});
					return {
						relativeArrayPoints: targetArray,
						absoluteArrayPoints: absoluteTargetArray
					};
				},


				/* 得到当前组件意外的组件的边缘坐标 包括，水平方向 x的位置，组件x方向全长，组件x方向组件0点到组件一半的长度。
				                                   垂直方向 y的位置，组件y方向全长，组件y方向组件0点到组件一半的长度。
				*/
				getLineGuideStops: function(skipShape) {
					// we can snap to stage borders and the center of the stage
					var vertical = [0, this.stage.width() / 2, this.stage.width()];
					var horizontal = [0, this.stage.height() / 2, this.stage.height()];

					// and we snap over edges and center of each object on the canvas
					this.stage.find('.jyzt_module_group').forEach(function(guideItem) {
						if (guideItem === skipShape) {
							return;
						}
						var box = guideItem.getClientRect();
						// and we can snap to all edges of shapes
						vertical.push([box.x, box.x + box.width, box.x + box.width / 2]);
						horizontal.push([box.y, box.y + box.height, box.y + box.height / 2]);
					});
					return {
						vertical: vertical.flat(),
						horizontal: horizontal.flat(),
					};
				},
				/**
				 * 拿到当前组件上边线，中线，下边线
				 *           左边，中心线，右边线
				 * @param node
				 * @returns {{horizontal: [{offset: number, guide: number, snap: string}, {offset: number, guide: number, snap: string}, {offset: number, guide: number, snap: string}], vertical: [{offset: number, guide: number, snap: string}, {offset: number, guide: number, snap: string}, {offset: number, guide: number, snap: string}]}}
				 */
				getObjectSnappingEdges: function(node) {
					var box = node.getClientRect();
					var absPos = node.absolutePosition();

					return {
						vertical: [{
								guide: Math.round(box.x),
								offset: Math.round(absPos.x - box.x),
								snap: 'start',
							},
							{
								guide: Math.round(box.x + box.width / 2),
								offset: Math.round(absPos.x - box.x - box.width / 2),
								snap: 'center',
							},
							{
								guide: Math.round(box.x + box.width),
								offset: Math.round(absPos.x - box.x - box.width),
								snap: 'end',
							},
						],
						horizontal: [{
								guide: Math.round(box.y),
								offset: Math.round(absPos.y - box.y),
								snap: 'start',
							},
							{
								guide: Math.round(box.y + box.height / 2),
								offset: Math.round(absPos.y - box.y - box.height / 2),
								snap: 'center',
							},
							{
								guide: Math.round(box.y + box.height),
								offset: Math.round(absPos.y - box.y - box.height),
								snap: 'end',
							},
						],
					};
				},

				// find all snapping possibilities
				getGuides: function(lineGuideStops, itemBounds) {
					var resultV = [];
					var resultH = [];

					lineGuideStops.vertical.forEach(function(lineGuide) {
						itemBounds.vertical.forEach(function(itemBound) {
							var diff = Math.abs(lineGuide - itemBound.guide);
							// if the distance between guild line and object snap point is close we can consider this for snapping
							if (diff < stageOper.GUIDELINE_OFFSET) {
								resultV.push({
									lineGuide: lineGuide,
									diff: diff,
									snap: itemBound.snap,
									offset: itemBound.offset,
								});
							}
						});
					});

					lineGuideStops.horizontal.forEach(function(lineGuide) {
						itemBounds.horizontal.forEach(function(itemBound) {
							var diff = Math.abs(lineGuide - itemBound.guide);
							if (diff < stageOper.GUIDELINE_OFFSET) {
								resultH.push({
									lineGuide: lineGuide,
									diff: diff,
									snap: itemBound.snap,
									offset: itemBound.offset,
								});
							}
						});
					});

					var guides = [];

					// find closest snap
					var minV = resultV.sort(function(a, b) {
						a.diff - b.diff
					})[0];
					var minH = resultH.sort(function(a, b) {
						a.diff - b.diff
					})[0];
					if (minV) {
						guides.push({
							lineGuide: minV.lineGuide,
							offset: minV.offset,
							orientation: 'V',
							snap: minV.snap,
						});
					}
					if (minH) {
						guides.push({
							lineGuide: minH.lineGuide,
							offset: minH.offset,
							orientation: 'H',
							snap: minH.snap,
						});
					}
					return guides;
				},
				drawGuides: function(guides) {
					guides.forEach(function(lg) {
						if (lg.orientation === 'H') {
							var line = new Konva.Line({
								points: [-6000, 0, 6000, 0],
								stroke: 'rgb(0, 161, 255)',
								strokeWidth: 1,
								name: 'guid-line',
								dash: [4, 6],
							});
							stageOper.layer_three.add(line);
							line.absolutePosition({
								x: 0.5,
								y: lg.lineGuide,
							});
							stageOper.layer_three.batchDraw();
						} else if (lg.orientation === 'V') {
							var line = new Konva.Line({
								points: [0, -6000, 0, 6000],
								stroke: 'rgb(0, 161, 255)',
								strokeWidth: 1,
								name: 'guid-line',
								dash: [4, 6],
							});
							stageOper.layer_three.add(line);
							line.absolutePosition({
								x: lg.lineGuide,
								y: 0.5,
							});
							stageOper.layer_three.batchDraw();
						}
					});
				},
				//给图层添加移动事件
				addLayerDragMove: function() {
					this.layer.on('dragmove', function(e) {
						transformerLength = 0; //移动的时候，吧框框框选的个数设置为0，移动结束后，等于0时计入Ctrl+z
						if (e.target.attrs.name.indexOf("edit_anchor") != -1) { //如果是线段的锚点，完成吸附在电力组件的锚点上
							/* var targetShape = e.target;
							 var targetShapeAbsolutePoint=targetShape.absolutePosition();//当前线段锚点的绝对位置。
							 var targetAnchorArr=stageOper.getAnchorArray();//拿到目标锚点 所有电力组件的锚点
							 console.log("当前锚点的绝对坐标："+targetShapeAbsolutePoint.x+" , "+targetShapeAbsolutePoint.y);
							 for (var i = 0; i <targetAnchorArr.absoluteArrayPoints.length ; i++) {
							     var pointTemp=targetAnchorArr.absoluteArrayPoints[i];//电力元件的锚点

							     var xoffset=pointTemp.x-targetShapeAbsolutePoint.x;
							     var yoffset=pointTemp.y-targetShapeAbsolutePoint.y;
							     if(Math.abs(xoffset)<=5&&Math.abs(yoffset)<=5){
							         console.log("电力组件锚点吸附坐标"+pointTemp.x+" , "+pointTemp.y);
							         targetShape.x(targetShape.x()+xoffset);//设置线段锚点的坐标
							         targetShape.y(targetShape.y()+yoffset);
							         //设置线段点的位置
							         var indexLable = targetShape.attrs.indexLable;//锚点的索引
							         var lineModule = targetShape.getParent();
							         var lingObject = lineModule.findOne(".line1");
							         var points = lingObject.points();//线段的全部坐标
							         points[indexLable * 2] =targetShape.x();
							         points[indexLable * 2 + 1] = targetShape.y();

							         lingObject.points(points);

							         stageOper.layer.batchDraw();
							     }

							 }*/


							return;
						}

						try {
							var transformerObj = stageOper.layer_three.findOne('.transformer');
							var trMoudle = transformerObj.nodes();
							if (trMoudle.length > 1) {
								return;
							}
						} catch (e) {

						}

						// clear all previous lines on the screen
						stageOper.layer_three.find('.guid-line').destroy();
						stageOper.layer_three.batchDraw();
						// 除当前组件以外的组件的坐标集合
						var lineGuideStops = stageOper.getLineGuideStops(e.target);
						//拿到当前组件上边线，中线，下边线
						//           左边，中心线，右边线
						var itemBounds = stageOper.getObjectSnappingEdges(e.target);

						// now find where can we snap current object
						var guides = stageOper.getGuides(lineGuideStops, itemBounds);

						// do nothing of no snapping X
						if (!guides.length) {
							return;
						}

						stageOper.drawGuides(guides);

						var absPos = e.target.absolutePosition();
						// now force object position
						guides.forEach(function(lg) {
							switch (lg.snap) {
								case 'start': {
									switch (lg.orientation) {
										case 'V': {
											absPos.x = lg.lineGuide + lg.offset;
											break;
										}
										case 'H': {
											absPos.y = lg.lineGuide + lg.offset;
											break;
										}
									}
									break;
								}
								case 'center': {
									switch (lg.orientation) {
										case 'V': {
											absPos.x = lg.lineGuide + lg.offset;
											break;
										}
										case 'H': {
											absPos.y = lg.lineGuide + lg.offset;
											break;
										}
									}
									break;
								}
								case 'end': {
									switch (lg.orientation) {
										case 'V': {
											absPos.x = lg.lineGuide + lg.offset;
											break;
										}
										case 'H': {
											absPos.y = lg.lineGuide + lg.offset;
											break;
										}
									}
									break;
								}
							}
						});
						//absPos.x= Math.round(absPos.x)+0.5;
						//absPos.y= Math.round(absPos.y)+0.5;
						e.target.absolutePosition(absPos);
					});

					this.layer.on('dragend', function(e) {
						// clear all previous lines on the screen
						stageOper.layer_three.find('.guid-line').destroy();
						stageOper.layer_three.batchDraw();
						try {
							var transformerObj = stageOper.layer_three.get(".transformer")[0];
							var edit_anchor_ = e.target.attrs.name;
							var moduleType = e.target.attrs.moduleType;
							var edit_anchor = e.target.find(".edit_anchor");

							if (transformerObj == undefined && edit_anchor_ != "edit_anchor") { //无框选的时候
								// 存入到撤销的数组
								stageOper.stackZfun();
								if (edit_anchor.length > 0 && moduleType == "BASELINE") { //线段
									stageOper.addLineEdit(e.target);
								}
								if (edit_anchor.length > 0 && moduleType == "FLOWLINE") { //流动条
									stageOper.addFlowLineEdit(e.target);
								}

							} else { //有框选的时候
								var objmoduleArrey = transformerObj.nodes();
								if (transformerLength == 0) {
									transformerLength = objmoduleArrey.length;

									if (edit_anchor_ != "edit_anchor" && edit_anchor.length == 0) {
										// 存入到撤销的数组
										stageOper.stackZfun();
										transformerObj = new Konva.Transformer({
											name: "transformer",
											id: Math.uuid(),
											padding: 5,
											rotationSnaps: [0, 90, 180, 270],
										});
										stageOper.layer_three.add(transformerObj);
										transformerObj.nodes(objmoduleArrey);
									}
								}
							}
						} catch (e) {
							// stackZ.push(stageOper.getStageJson());
						}
					});
				},

				//获取场景绑定的所有数据点（数据点编号）
				getStageAllDataKey: function() {
					var groups = this.stage.find('Group');
					var allDataKey = new Array();
					groups.each(function(group) {
						var keys;
						var rotateKeys;
						var hideKeys;
						var sparkling;




						try {
							keys = eval("(" + group.attrs.dataKey + ")").key;
							if (keys != "" && keys != "null" && keys != null && typeof(keys) !=
								"undefined" &&
								keys != "undefined" && keys != undefined) {
								if (!stageOper.checkArray(allDataKey,
									keys)) { //看看 数组里面有没有这个值，没有时才网数组里面放
									allDataKey.push(keys);
								}
							}
						} catch (e) {}
						//旋转
						try {
							var rotateKeysArr = eval("(" + group.attrs.rotateWhere + ")");
							for (var i in rotateKeysArr) {
								var rotateobj = rotateKeysArr[i];
								var devicecode = rotateobj.devicecode;
								if (devicecode != "" && devicecode != "null" && devicecode != null &&
									typeof(
										devicecode) != "undefined" && devicecode != "undefined" &&
									devicecode !=
									undefined) {
									if (!stageOper.checkArray(allDataKey,
											devicecode)) { //看看 数组里面有没有这个值，没有时才网数组里面放
										allDataKey.push(devicecode);
									}
								}
							}
						} catch (e) {}
						//隐藏
						try {
							var hideKeysArr = eval("(" + group.attrs.hideWhere + ")");
							for (var i in hideKeysArr) {
								var hideobj = hideKeysArr[i];
								var devicecode = hideobj.devicecode;
								if (devicecode != "" && devicecode != "null" && devicecode != null &&
									typeof(
										devicecode) != "undefined" && devicecode != "undefined" &&
									devicecode !=
									undefined) {
									if (!stageOper.checkArray(allDataKey,
											devicecode)) { //看看 数组里面有没有这个值，没有时才网数组里面放
										allDataKey.push(devicecode);
									}
								}
							}
						} catch (e) {}
						//闪烁
						try {
							var sparklingArr = eval("(" + group.attrs.sparklingWhere + ")");
							for (var i in sparklingArr) {
								var sparklingobj = sparklingArr[i];
								var devicecode = sparklingobj.devicecode;
								if (devicecode != "" && devicecode != "null" && devicecode != null &&
									typeof(
										devicecode) != "undefined" && devicecode != "undefined" &&
									devicecode !=
									undefined) {
									if (!stageOper.checkArray(allDataKey,
											devicecode)) { //看看 数组里面有没有这个值，没有时才网数组里面放
										allDataKey.push(devicecode);
									}
								}
							}
						} catch (e) {}




					});
					return allDataKey.toString();
				},

				//看看 数组里面有没有这个值，没有时才网数组里面放
				checkArray: function(dataKeyArray, datakey) {
					var isempty = false;
					for (var i = 0; i < dataKeyArray.length; i++) {
						if (dataKeyArray[i] == datakey) {
							isempty = true;
							break;
						}
					}
					return isempty;
				},

				//获取画面base64缩略图
				getStageBase64: function() {
					var imageBase64 = this.stage.toDataURL();
					return imageBase64;
				},

				/**
				 * 压缩base64图片的方法
				 * @param base64  base64原图
				 * @param w  压缩后需要的宽度
				 * @param callback 回调方法
				 */
				dealImage: function(base64, w, callback) {
					var newImage = new Image();
					var quality = 0.6; //压缩系数0-1之间
					newImage.src = base64;
					newImage.setAttribute("crossOrigin", 'Anonymous'); //url为外域时需要
					var imgWidth, imgHeight;
					newImage.onload = function() {
						imgWidth = this.width;
						imgHeight = this.height;
						var canvas = document.createElement("canvas");
						var ctx = canvas.getContext("2d");
						if (Math.max(imgWidth, imgHeight) > w) {
							if (imgWidth > imgHeight) {
								canvas.width = w;
								canvas.height = w * imgHeight / imgWidth;
							} else {
								canvas.height = w;
								canvas.width = w * imgWidth / imgHeight;
							}
						} else {
							canvas.width = imgWidth;
							canvas.height = imgHeight;
							quality = 0.6;
						}
						ctx.clearRect(0, 0, canvas.width, canvas.height);
						ctx.drawImage(this, 0, 0, canvas.width, canvas.height);
						var base64 = canvas.toDataURL("image/jpeg", quality); //压缩语句
						// 如想确保图片压缩到自己想要的尺寸,如要求在50-150kb之间，请加以下语句，quality初始值根据情况自定
						// while (base64.length / 1920 > 150) {
						// 	quality -= 0.01;
						// 	base64 = canvas.toDataURL("image/jpeg", quality);
						// }
						// 防止最后一次压缩低于最低尺寸，只要quality递减合理，无需考虑
						// while (base64.length / 1920 < 50) {
						// 	quality += 0.001;
						// 	base64 = canvas.toDataURL("image/jpeg", quality);
						// }
						callback(base64); //必须通过回调函数返回，否则无法及时拿到该值
					}
				},
				/**在回调方法中调用保存
				 *
				 * @param base64  压缩后的画面缩略图
				 */

				callbackSaveStageAll: function(base64) {
					var stageObjJsonString = stageOper.getStageJson();
					if (typeof(stage_id) == "undefined") {
						stage_id = '';
					}
					//获取该场景所有的绑定的数据点（数据点的编号）
					var dataKeyArr = stageOper.getStageAllDataKey();
					//initConfig.saveStageData(stageObjJsonString, dataKeyArr, base64, UrlParam);
					//使用了老方法
					stage_id = initConfig.saveStageData(stageObjJsonString, stage_id, dataKeyArr, base64,
						userId);
				},

				/**
				 *保存到画面模板
				 * @param base64  压缩后的画面缩略图
				 */

				// callbackSaveStageModule: function(base64) {
				// 	var stageModuleObjJson = stageOper.getStageJson();
				// 	if (typeof(stageModule_id) == "undefined") {
				// 		stageModule_id = '';
				// 	}

				// 	layer.open({
				// 		title: '请编辑画面模板名称',
				// 		type: 2,
				// 		area: ['452px', '300px'],
				// 		fixed: false, //不固定
				// 		maxmin: true,
				// 		content: 'stageModuleName.html?stageModuleName=' + stageModuleName,
				// 		end: function(index, layero) {
				// 			if (isCancel == 1) {
				// 				stageModule_id = initConfig.saveStageModuleData(stageModuleObjJson,
				// 					stageModule_id, base64, stageModuleName, UrlParam);
				// 			} else {

				// 			}

				// 		},
				// 		cancel: function(index, layero) {
				// 			isCancel = 0;
				// 			//return false;
				// 		}



				// 	});






				// },
				stackZfun: function() {
					stackZ.push(stageOper.getStageJson());
					if (stackZ.size() >= 10) {
						stackZ.shift();
					}
				},
				addTransformer: function() {
					stageOper.layer_three.find(".transformer").destroy();
					var tr = new Konva.Transformer({
						name: "transformer",
						id: Math.uuid(),
						padding: 5,
						rotationSnaps: [0, 90, 180, 270],
					});
					tr.nodes(transformerArrayTemp);
					stageOper.layer_three.add(tr);
					stageOper.layer_three.draw();
				},
				/**
				 * 校验只要是数字（包含正负整数，0以及正负浮点数）就返回true
				 * @param val
				 * @returns {boolean}
				 */
				isNumber: function(val) {

					var regPos = /^\d+(\.\d+)?$/; //非负浮点数
					var regNeg =
						/^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
					if (regPos.test(val) || regNeg.test(val)) {
						return true;
					} else {
						return false;
					}
				}



		}
		win.StageOperation = StageOperation;
	}(window);
